resource instance
One of the objects a resource block produces; a block with count or for_each has several, each with its own index or key.
In more detail
Terraform tracks each instance by its full address in state. If the item behind an index or key changes, Terraform sees a different object at that address and plans updates, replacements or deletions to match. Deciding what makes an instance the same object over time is the real choice between count and for_each.
Related terms
- count meta-argument — The count argument, which creates that many numbered copies of a resource or module, addressed as name[0], name[1] and so on.
- for_each — The for_each argument, which creates one instance of a resource or module per element of a map or set, addressed by key such as name["a"].
- resource address — The type and name of a resource joined by a dot, such as local_file.greeting, which identifies it everywhere.
Taught in
- Scaling Resources With Count — Infrastructure as Code with Terraform
- Iterating Over Maps With For Each — Infrastructure as Code with Terraform
- Explicit Dependencies With Depends On — Infrastructure as Code with Terraform
- Safe Changes With Lifecycle Rules — Infrastructure as Code with Terraform
- Provisioners: Why They Are A Last Resort — Infrastructure as Code with Terraform
- Inspecting And Repairing State From The CLI — HashiCorp Terraform Associate (004) Exam Prep