Terraform
applyの単位を分けるにはどうしたらいいか
ディレクトリ構成はどのようにしたらいいか
resource "..." "..." { ... } みたいなの
インフラリソースを指す
一対一対応とは限らない (Each resource block describes one or more infrastructure objects) のはproviderの実装次第で物理リソースを複数つくることもあるからか
for_each で再帰させることもできる
A resource block describes your intent for a particular infrastructure object to exist with the given settings
A module is a container for multiple resources that are used together. Modules can be used to create lightweight abstractions, so that you can describe your infrastructure in terms of its architecture, rather than directly in terms of physical objects.
複数のresourceをまとめたもの
applyの単位ではない
(1つ以上の) configurationから呼ばれて使われる
module has many resources
stateを管理する単位
workspaces = configuration * environment
environment = stagingとかprodとか
構造的境界に応じて分ける場合
teams should use multiple separate Terraform configurations that correspond with suitable architectural boundaries within the system so that different components can be managed separately
workspaces = architectural boundaries
configuration
公式でそのものずばりと言及されていないけどarchitectural boundariesに相当する概念として使われていそう
teams should use multiple separate Terraform configurations that correspond with suitable architectural boundaries within the system so that different components can be managed separately
each environment of a given configuration should be a separate workspace — in other words, Terraform configurations * environments = workspaces