Infrastructure as Code

Describing infrastructure so it can be reviewed, reproduced and changed safely — plans, state, drift, and the destructive changes a rename can hide.

Infrastructure as Code

Describing infrastructure in reviewed, versioned files so it can be reproduced and changed with the same evidence as application code.

Q · The console already works. Why write the infrastructure down?
Declarative vs Imperative Infrastructure

Describing the end state and letting a tool derive the steps, versus writing the steps yourself — and the cases where writing the steps is still correct.

Q · Is describing the desired end state actually better than scripting the steps, or is that just fashion?
The Plan: Desired vs Current

A plan is a diff between what the code says and what exists, classified into create, update, replace and delete — and every destructive line in it needs a human.

Q · What exactly is a plan telling me, and which parts of it must a person read before it runs?
State

The mapping between configuration addresses and real resources — why it must exist, why it goes stale, why it holds secrets, and what concurrent applies do to it.

Q · Why does the tool need a state file at all when it could just ask the cloud what exists?
Drift

Reality diverging from what the code says — how it happens, which of it is legitimate, and why the next apply is the dangerous moment.

Q · The code says one thing and production does another. Which one is wrong?
Immutable Infrastructure

Replacing servers instead of modifying them, so that what is running is a known function of an artifact rather than the sum of its history.

Q · Why replace a working machine to change one package, instead of just changing the package?
Pets and Cattle, Read Carefully

A useful metaphor about replaceability that becomes dangerous when treated as a rule — because some infrastructure genuinely is irreplaceable, and a database treated as cattle is a data loss event.

Q · Should every server be disposable, and what happens to the ones that are not?
Destructive Changes: What a Rename Really Does

Renaming a resource in configuration is read as delete-then-create, because the tool identifies resources by their address — and on a database that is the end of the data.

Q · I renamed a resource block. Why does the plan say it will be destroyed?