6.3. Managing Drift and Refactoring State
💡 First Principle: Two different forces make state diverge from intent — the world changing outside Terraform (drift) and you renaming things in config (refactoring) — and 004 gives a distinct, non-destructive tool for each: refresh for drift, moved/removed for refactoring.
Why care: Drift handling and the new moved/removed blocks are explicitly emphasized in 004. They're also where engineers most often cause accidental destroy-and-recreate, so the exam probes the safe paths.
The mental model: Drift is finding that someone rearranged your warehouse without telling you (refresh updates your map). Refactoring with moved is relabeling a shelf in your own map without touching the goods; removed is crossing an item off your inventory while leaving it on the shelf.
⚠️ Common Misconception: "Renaming a resource in my config just renames it." It doesn't — to Terraform, the old address vanished and a new one appeared, so by default it plans a destroy and recreate. The moved block is what makes a rename a state-only operation.