Introduction
When you change the names or locations of resources in your Terraform code, the state file still remembers the old names. Terraform state mv helps you update the state file to match your new code without destroying or recreating resources.
When you rename a resource block in your Terraform configuration to better reflect its purpose.
When you move a resource from one module to another in your Terraform project.
When you split a large Terraform configuration into smaller modules and need to update the state accordingly.
When you want to reorganize your infrastructure code but keep the existing resources intact.
When you fix a typo in a resource name after initial deployment.