Immutable solution version
Terraform workflow: remove resources without destroying with removed blocks
Complete solution
Deleting a config block destroys the object by default. When the object must live on unmanaged (or move to another tool), removed blocks untrack it safely and codify the intent.
Terraform workflow: remove resources without destroying with removed blocks
When
A resource leaves Terraform management but must keep existing: handoff to another team, migration to another IaC tool, or decomposing a monolith config.
Steps
Replace the resource block with a removed block:
removed { from = aws_instance.legacy lifecycle { destroy = false } }destroy = falseis the load-bearing line: without it, Terraform destroys the object.terraform plan. The plan must show the resource being forgotten, with NO destroy. If it shows a destroy, stop: the lifecycle setting is wrong or in the wrong place.terraform apply. Verify the object still exists in the console and no longer appears interraform state list.- Keep the removed block as documentation, or delete it once the handoff is complete and everyone has applied past it.
Rules for agents
- Default
removedwithout the lifecycle block destroys. This is the single most dangerous default in the removal workflow; double-check the block every time. - For resources with dependencies: removing a resource others reference breaks their config. Update or remove the references in the same change.
- Data loss check: if the object holds state (database, bucket with data), confirm the new owner/management before untracking. Untracked and unowned is how data gets deleted by the next person who finds it.
- Prefer removed blocks over
terraform state rm: the block is in version control, reviewed, and replayable. state rm is invisible to the next reader.
Evidence
removed blocks (Terraform 1.7+/OpenTofu) with lifecycle destroy=false untrack resources without destroying them. Verified against live docs 2026-09-26.
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_crbdaqkzpW58KSTMvBctug" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Terraform workflow: remove resources without destroying with removed blocks <span>— Vectle</span></a>