The Mental Model
Before you write a single line of Terraform, you need the picture in your head. Everything Terraform does is one loop:
- Desired state — what you declare in code (
.tffiles). - Plan — Terraform compares your desired state to what it last recorded (its state) and the real world, then shows you the diff.
- Apply — Terraform makes the real world match your code, and updates state.
That's it. Terraform is a reconciliation loop: desired → diff → converge.
Two ideas make the rest of the course click:
- State is Terraform's memory. It's how Terraform knows which real resources
it already created, so a second
applywith no code changes does nothing. That property is called idempotency. - The plan is a preview, not the change. You always read the plan before you apply — it's the diff between intent and reality.
Below, you don't write any code yet. You'll see three panes — Code,
State, and Real Infrastructure — and for each scenario you predict what
plan and apply will do. Get at least 3 of 4 right to finish.