removed block: what it does, when to use it, and the correct workflow to remove resources from Terraform state without destroying the underlying infrastructure.
Real-world scenario: production databases
You’ve been managing two production PostgreSQL instances with Terraform for months. The database team now needs full manual control of schema changes on one instance (for example, production-db-02) and asks that Terraform stop managing that instance so they can make manual changes safely.

prd_db_2 resource block from code and running terraform plan will make Terraform interpret the resource as removed from configuration and propose to destroy the real infrastructure:
removed block provides a safer, declarative way to do this.
What the removed block does
- Removes the specified resource address from Terraform state so Terraform stops managing it.
- Leaves the actual infrastructure running and untouched.
- Is useful for handing resources off to other teams, transitioning to manual management, or splitting a monolithic configuration.
from— specifies the resource address to remove from state. Use the resource address exactly as it appears in configuration (for example,google_sql_database_instance.prd_db_2).removedblocks only need thefromargument. They instruct Terraform to remove the matching resource from state without destroying the underlying infrastructure.- Always validate behavior in your Terraform version and provider. See HashiCorp’s refactoring docs for details: https://developer.hashicorp.com/terraform/language/state/refactoring
removed blocks for the two databases:
When using a
removed block, the resource definition must be absent (or commented out) from your configuration first. Terraform will refuse to remove a resource from state if that resource still exists in code.removed block for it, Terraform will be unable to reconcile them. Follow this workflow:
- Delete or comment out the resource blocks you want Terraform to stop managing.
- Add a
removedblock for each resource to be forgotten. - Run
terraform planto inspect the proposed state change. - Run
terraform applyto update the state file and remove the resource from Terraform state. - After the state is updated, delete the temporary
removedblocks from your configuration (they are not required after apply but can be kept for documentation).
removed/moved block) → Plan → Apply → Delete (temporary scaffolding).

removed vs moved — quick guidance
- Use
movedwhen refactoring addresses within Terraform (renaming resources, moving to modules, etc.).movedupdates state to reflect a change in resource address while leaving infrastructure intact. - Use
removedwhen you want Terraform to stop managing a resource entirely (hand-off to another team, manual management, or transferring to another state/workspace).removeddeletes the resource from state without deleting the actual infrastructure.
| Action | Use case | Terraform block | Result |
|---|---|---|---|
| Rename or re-address resource | Refactoring code, moving resources into modules | moved | State updated to new addresses; infrastructure unchanged |
| Stop Terraform management / hand off resource | Transferring ownership; manual management | removed | Resource removed from state; infrastructure unchanged |
| Remove resource from configuration without state change | Temporary removal from config while still managed | None (use careful planning) | Terraform will propose to delete resource unless you remove it from state first |

- Hand off resources to another team: remove them from your state so another team can import them into theirs.
- Migration from another IaC tool: import resources into Terraform and
removedormovedas part of a staged migration. - Split monolithic configurations or separate environments: remove resources from one state and import them into another workspace or project.
- If you are renaming or reorganizing within Terraform → use
moved. - If you are transferring ownership or stopping Terraform management → use
removed. - Migration scenarios often combine
importwithremoved/movedactions depending on the direction of transfer.

Do not leave a resource block in your configuration while also declaring a
removed block for the same address. Terraform will not be able to reconcile them and the operation will fail. Always test removed workflows in non-production environments first.- The
removedblock is a powerful, but intentionally infrequent, tool. Use it when you need Terraform to forget a resource while keeping the physical resource intact. - Practice this workflow in a safe environment and double-check behavior for your Terraform version and provider.
- Terraform state refactoring: https://developer.hashicorp.com/terraform/language/state/refactoring
- Terraform state commands overview: https://developer.hashicorp.com/terraform/cli/commands/state
removed block. Use it when you need Terraform to stop tracking a resource without deleting the actual infrastructure.