Manage resource drift and Terraform state
Unlock the complete study guide + 1,040 practice questions across 16 full exams.
Bundled into the existing HashiCorp Certified: Terraform Associate premium course — no separate purchase.
14-day money-back guarantee — no questions asked.
Included in this chapter:
- State is Terraform's ledger of reality
- Detecting drift with plan and -refresh-only
- Accepting drift: apply -refresh-only
- Refactoring state: mv, rm, moved, removed
- Exam pattern recognition
State-maintenance operations: what each one touches
| Operation | What it changes in state | Touches real infrastructure? | Reviewed via plan/apply? |
|---|---|---|---|
| plan -refresh-only | Nothing; reports drift only | No | Read-only preview |
| apply -refresh-only | Records observed drift | No | Yes, with approval |
| state mv | Rebinds object to a new address | No | No, immediate |
| state rm | Removes the object's binding | No | No, immediate |
| moved block | Rebinds address, like state mv | No | Yes |
| removed block | Removes binding, like state rm | Destroys unless destroy=false | Yes |
Decision tree
Cheat sheet
Unlock with Premium — includes all practice exams and the complete study guide.