1. [Home](<https://delaparra-services.nl/>) 
1. [Knowledge hub](<https://delaparra-services.nl/knowledge-hub>) 
1. [state mv / rm](<https://delaparra-services.nl/knowledge-hub/state-mv-rm>)

  

Category: Terraform 

# state mv / rm

  Explained by [Reinier de la Parra](<https://delaparra-services.nl/about>)  Updated November 25, 2026    

## What is state mv / rm?

 

state mv / rm: Surgically move a resource’s address (after a refactor) or remove it from state without destroying the real resource. ` terraform state mv ` and ` terraform state rm ` change Terraform's records without touching real infrastructure. ` state mv ` gives a resource a new address, for example after renaming it or moving it into a module. ` state rm ` makes Terraform forget a resource, while it keeps existing in the cloud.

 

Definition source [Coders Lingo](<https://coderslingo.com/resources/open-dataset/>), [CC BY 4.0](<https://creativecommons.org/licenses/by/4.0/>)

 

## Frequently asked questions about state mv / rm

  

### How is state mv / rm used in practice?

 

Without ` state mv `, a rename looks to Terraform like deleting one resource and creating another, which could destroy and recreate a database.

    

### What should you keep in mind with state mv / rm?

 

Newer Terraform versions offer ` moved ` and ` removed ` blocks in configuration that do the same thing. They are usually better, because the change is reviewed in a pull request and applied consistently in every environment. Whichever you use, back up the state first and run a plan afterwards to confirm nothing unexpected will be destroyed.

    

### What does an example of state mv / rm look like?

 

```
terraform state mv aws_s3_bucket.old aws_s3_bucket.new terraform state rm aws_s3_bucket.logs
```

 

## At a glance

   CategoryTerraform Explained by[Reinier de la Parra](<https://delaparra-services.nl/about>) UpdatedNovember 25, 2026

 

## More Terraform terms

 

- [resource](<https://delaparra-services.nl/knowledge-hub/resource>) 
- [state file](<https://delaparra-services.nl/knowledge-hub/state-file>) 
- [state lock](<https://delaparra-services.nl/knowledge-hub/state-lock>) 
- [taint](<https://delaparra-services.nl/knowledge-hub/taint-terraform>) 
- [ternary](<https://delaparra-services.nl/knowledge-hub/ternary>) 
- [terraform block](<https://delaparra-services.nl/knowledge-hub/terraform-block>)

 

[All terms starting with S](<https://delaparra-services.nl/knowledge-hub#letter-s>)

 

## Skills

 

- ### Terraform safe workflow

 

Use when running or changing Terraform (or OpenTofu) - init, fmt, validate, plan, apply, destroy, import, state mv/rm, refresh, workspaces, remote backends, state locking, drift, taint/-replace. Enforces a plan-review-apply workflow and protects state.

 [View skill](<https://delaparra-services.nl/skills/terraform-safe-workflow>) [Download zip](<https://delaparra-services.nl/skills/terraform-safe-workflow/download>) 
- ### Terraform Module Library

 

Build reusable Terraform modules for AWS, Azure, GCP, and OCI infrastructure following infrastructure-as-code best practices. Use when creating infrastructure modules, standardizing cloud provisioning, or implementing reusable IaC components.

 [View skill](<https://delaparra-services.nl/skills/terraform-module-library>) [Download zip](<https://delaparra-services.nl/skills/terraform-module-library/download>)

 [Download all skills (zip)](<https://delaparra-services.nl/knowledge-hub/state-mv-rm/skills.zip>)

 

## Manuals

 

- [Kubernetes and Terraform: do you need them?](<https://delaparra-services.nl/manuals/kubernetes-en-terraform-heb-je-het-nodig>)

 

## Related services

 

- [Custom software and web applications](<https://delaparra-services.nl/services#service-03>)

Perhaps your customers need somewhere to download their invoices, or your staff are managing bookings in a spreadsheet.

 

## Need any help?

 

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.

  [Get in touch](<https://delaparra-services.nl/availability>)

[HTML version](https://delaparra-services.nl/knowledge-hub/state-mv-rm)
