Pcornel
Automation · Terraform / OpenTofu

Resources

Cheat sheet · https://pcornel.dk/topic.php?topic=5443

Back to the Topic

Answer

Terraform/OpenTofu resource blocks declare managed resource instances whose remote identities are tracked in state and reconciled by provider lifecycle operations.

Remember

  • Resource block ≠ single instance automatically; count/for_each and moved addresses can change instance identity and replacement behavior.
  • Terraform/OpenTofu command success ≠ target workload health; provider operations and application acceptance are separate proof boundaries.
  • The same repository ≠ same run when binary, provider/module versions, backend/workspace, variables, credentials or lock selections differ.
  • Treat Terraform and OpenTofu as separate implementations: verify behavior against the pinned tool and dependency versions rather than assuming interchangeability.

First checks

  • terraform state list — managed resources
  • terraform state show <addr> — attributes
  • for_each over count for stable addresses — design

Verify in this order

resource block → API object

Where it usually breaks

Resource block ≠ single instance automatically; count/for_each and moved addresses can change instance identity and replacement behavior. The proof boundary ends where provider/state evidence stops and target-domain acceptance begins.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5443

Confirmation

Confirm action

Continue?