Pcornel
Automation · Infrastructure as Code

Variables

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

Back to the Topic

Answer

IaC variables provide external inputs that shape the evaluated configuration and therefore the resulting graph, plan and target scope.

Remember

  • Variable declared ≠ effective value; defaults, environment, files, automation and CLI inputs may alter precedence.
  • State or engine metadata ≠ authoritative live-service health; always confirm with provider read-back and target acceptance checks.
  • A green execution step ≠ complete convergence when later state persistence, external dependencies or workload readiness remain unverified.
  • Provider/API success ≠ business outcome; keep engine evidence and target-domain evidence separate.

First checks

  • terraform console <<< 'var.<name>' — value
  • variable blocks with type and validation — input checks
  • sensitive = true for secrets — masking

Verify in this order

tfvars/env → variables → validated

Where it usually breaks

Variable declared ≠ effective value; defaults, environment, files, automation and CLI inputs may alter precedence. The proof boundary ends where provider/state evidence stops and target-domain acceptance begins.

Input/desired state → request accepted → job/task terminal status → target object read-back → effective runtime state → original workload → regression/rollback readiness. Preserve at least three independent checks: prerequisite/interface or identity/transport state; the owning control/service/policy state; then effective data-plane, backend or workload state. A healthy upstream boundary does not prove the downstream consumer or return path.

Variables IaC proof-boundary map

BoundaryHealthy evidenceSuspicious evidence
Definition / inputsExact revision, toolchain and effective inputs are reproducibleDifferent runner/version/input context changes evaluation
State / planningCorrect backend/state/lock, fresh reads and reviewed graph/planWrong state/workspace, stale reads, unsafe replacement/destroy or missing lock
ExecutionExpected provider/API operations complete and state persistsPartial apply, auth/API error, ambiguous retry or failed state write
Target proofIndependent read-back plus fresh plan confirm intended convergenceEngine success treated as workload acceptance or drift remains unexplained

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

Confirmation

Confirm action

Continue?