Pcornel
Automation · Automation Fundamentals

Infrastructure as Code

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

Back to the Topic

Answer

Infrastructure as Code represents infrastructure intent in versioned machine-readable definitions that can be reviewed, planned, tested and applied through controlled automation.

Remember

  • Code in Git ≠ deployed infrastructure state.
  • Plan success ≠ apply success; provider APIs and concurrent changes can alter execution.
  • State file ≠ infrastructure itself; it is a management record that can drift from the target.
  • IaC ≠ immutable infrastructure automatically; update, replace and import semantics vary by provider/resource.

First checks

  • terraform plan — infra changes
  • tflint / checkov -d . — IaC lint and security scan
  • git log -- infra/ — reviewed history

Verify in this order

code → plan → review → apply → state

Where it usually breaks

IaC source proves intended infrastructure definition; plan and state records do not prove the real target matches until provider read-back and service checks confirm it.

Infrastructure as Code automation boundary map

BoundaryHealthy evidenceSuspicious evidence
Intent / inputsOwner, scope and authoritative inputs are explicit and versioned where applicableHidden defaults, stale inventory or competing sources of truth
Decision / executionPlan or decision is explainable and actions are bounded per targetBlind fan-out, implicit assumptions or success based only on executor status
State / verificationTarget is re-observed and acceptance criteria prove the intended outcomeNo read-back, perpetual drift, partial side effects or unresolved exceptions
Recovery / evidenceRetry, rollback or escalation behavior is defined and auditableUnknown partial completion, unsafe retry or evidence lost during remediation

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

Confirmation

Confirm action

Continue?