hardConceptDesignMidSeniorStaff
Why is state the hard part of Terraform, and how do you manage drift, imports and locking around it?
6 min readUpdated 2026-08-15
Answer
Short answer
State is the mapping from a config address to a real resource ID, so it is the only thing that tells Terraform whether to create or update. Drift, imports, refactors and concurrent applies are all consequences of that mapping being separate from both the code and the infrastructure.
Mention iac where it changes the risk, the owner, or the next check. A useful iac point should make the answer more testable, not merely longer.
Was this answer helpful?
Likely follow-ups
- Someone ran an apply from a laptop while CI was mid-apply and the lock was released by hand. What do you do now?
- You need to move three resources out of a monolithic state into a new one without any downtime. How?
- A plan wants to replace a resource because of a change to an attribute the provider marks as forcing replacement. What are your options?
- When would you deliberately not use a module, and what does a module that wraps a single resource cost you?
Related questions
- A Terraform plan in CI wants to destroy resources in production. What has to happen before anyone is allowed to approve it?hardAlso on terraform and iac6 min
- What is the difference between data drift and concept drift, and does it change what you do?mediumAlso on drift5 min
- How do you decide when to retrain a model?mediumAlso on drift5 min
- Your labels arrive months after the prediction, or never. What do you monitor?hardAlso on drift5 min