Terraform & IaC
Terraform state: what it maps and why it matters
A pull request that only renames a resource label plans to delete a bucket holding 90 GB of logs. State explains why, and one moved block fixes it.
What is in the lesson
- A real situation where this goes wrong
- How it works, step by step
- A walkthrough with commands you can run
- How it fails in production, and how to tell
- Three quiz questions with explanations
Read this lessonFree. No account needed.
More in Terraform & IaC
- The Terraform workflow: init, plan, apply, destroyBeginner · 5 min
Four commands, one rule: read the output of the second before you run the third. Create a bucket, prove nothing is left to change, then delete it again.
- Variables, outputs and localsBeginner · 5 min
One set of files, two environments: how variables, locals and outputs let the same code build staging and prod, and which source of values wins when two disagree.
- Remote state and lockingBeginner · 5 min
Two engineers apply within seconds of each other. Without a shared state and a lock, one run overwrites the other's record. Here is how the second one gets stopped…
- Lifecycle ignore_changesBeginner · 4 min
Lifecycle ignore_changes suppresses plans for selected attribute drift.
- create_before_destroyBeginner · 4 min
create_before_destroy requests replacement creation before deletion.
- Providers and version lockingBeginner · 5 min
Why a pipeline that passed for three months can start changing 14 resources on a Monday, and the two files that stop it.