Pcornel
Automation

Terraform / OpenTofu

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

Back to the Topic

Answer

Terraform and OpenTofu are separate IaC implementations that evaluate HCL-style configuration, resolve providers/modules, maintain state and execute dependency-aware plans against infrastructure APIs.

Remember

  • Terraform/OpenTofu similarity ≠ universal interchangeability; behavior, features, registries and compatibility must be verified against pinned tool/provider/module versions.
  • 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 version / tofu version — CLI and provider versions
  • terraform fmt -check && terraform validate — static checks
  • terraform plan — preview

Commands

terraform fmt
Format Terraform files to the standard style.
terraform show
Show the current state or a saved plan.

Verify in this order

HCL → init → plan → apply → state

Where it usually breaks

Terraform/OpenTofu similarity ≠ universal interchangeability; behavior, features, registries and compatibility must be verified against pinned tool/provider/module versions. The proof boundary ends where provider/state evidence stops and target-domain acceptance begins.

Automation/controller success is not target-state proof; target config/state is not effective-runtime proof; effective state is not workload proof.

Terraform evidence chain

BoundaryQuestionEvidenceDoes not prove
DefinitionWhat is configured or intended?running configuration / controller policylive operation
Local stateIs the feature active at the expected scope?terraform planremote success
CountersDid controlled traffic or an event reach this stage?scoped counters/timestampscomplete return path
Next boundaryWhat consumes or transports this state?source of truth/input → schema/model → authentication/authorization → plan/diff → controlled execution → task/result → realized-state assertionapplication success

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

Confirmation

Confirm action

Continue?