Moved block missing — planned destroy for resource that still exists
terraform plan shows - destroy for a resource that is still live
Focused incident mode — strips away everything but this runbook.
Symptoms
- terraform plan shows - destroy for a resource that is still live
- Resource renamed in code but old state entry still exists
- Plan shows create + destroy instead of in-place update
Evidence to grab
Collect these artifacts before you change anything — they prove (or rule out) each cause.
Plan showing destroy + create
terraform plan 2>&1 | grep -E '(\+|\-)' | head -20State list of resources
terraform state list | grep <OLD-NAME>
Diagnostic flow
Run the steps in order, marking each claim confirmed or refuted. The evidence you gather feeds the ranked causes below.
Guided decision tree is ready.
Steps with commands, expected output, and pass/fail branches.
Ranked root causes
Evidence checklist
- Code changed resource name from aws_instance.old to aws_instance.new
- terraform state list still shows aws_instance.old
- Plan shows destroy old + create new
Confirm before fixing
terraform state list | grep '<OLD-NAME>'Confirm old state entry exists
Fix
terraform state mv <OLD-ADDR> <NEW-ADDR>Migrate state to the new resource address
Expected: Successfully moved 1 object(s)
Resolution runbook
Apply from top to bottom after the cause is confirmed. Review every command before running it — risk tags are shown on each.
terraform plan 2>&1 | grep 'will be destroyed' | head -10Identify resources that will be destroyed
terraform state list | grep <OLD-NAME>Confirm the old state entry
terraform state mv <OLD-ADDR> <NEW-ADDR>Migrate state to match the new code
terraform planVerify no unexpected destroys
Prevention
- Always use moved blocks when renaming resources in Terraform >= 1.1.
- Use terraform state mv for resources renamed before moved block support.
- Run terraform plan before apply to catch unintended destroy/create cycles.
- Add moved blocks to the same PR that renames resources.
Related runbooks
Same stack, same failure family — worth a skim.
terraform plan shows - destroy for resources that should exist
terraform plan shows everything will be created (no existing resources in state)
Commands marked READ CHANGE DESTRUCTIVE — never run DESTRUCTIVE commands against production data you cannot restore. Copy → verify → execute.