terraform state mv aws_instance.web aws_instance.web2

Category: IaC & Automation

terraform state mv aws_instance.web aws_instance.web2

Move a resource to a new address in state

Renames a resource entry in the state file, typically after renaming a configuration block or moving it into a module. A timestamped state backup is written before any change, and the configuration must be updated to match. Related: terraform state rm aws_instance.web.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.