Pcornel
Automation · Terraform / OpenTofu

Plan

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

Back to the Topic

Answer

Terraform/OpenTofu plan compares evaluated configuration, selected state and provider reads to propose concrete resource actions.

Remember

  • Saved plan ≠ evergreen plan; remote state, credentials or dependencies can become stale before execution.
  • 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 plan -out=tfplan — saved plan
  • terraform show -no-color tfplan > plan.txt — review text
  • conftest test plan.json / checkov -f plan.json — policy on plan

Verify in this order

state + code + real → plan

Where it usually breaks

Saved plan ≠ evergreen plan; remote state, credentials or dependencies can become stale before execution. The proof boundary ends where provider/state evidence stops and target-domain acceptance begins.

Configuration/input → graph/state refresh → plan → provider API request → provider terminal result → resource read-back → effective service state → workload.

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

Confirmation

Confirm action

Continue?