Automation · Automation Fundamentals
Infrastructure as Code
Cheat sheet · https://pcornel.dk/topic.php?topic=5163
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 changestflint / checkov -d .— IaC lint and security scangit 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
| Boundary | Healthy evidence | Suspicious evidence |
|---|---|---|
| Intent / inputs | Owner, scope and authoritative inputs are explicit and versioned where applicable | Hidden defaults, stale inventory or competing sources of truth |
| Decision / execution | Plan or decision is explainable and actions are bounded per target | Blind fan-out, implicit assumptions or success based only on executor status |
| State / verification | Target is re-observed and acceptance criteria prove the intended outcome | No read-back, perpetual drift, partial side effects or unresolved exceptions |
| Recovery / evidence | Retry, rollback or escalation behavior is defined and auditable | Unknown 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