Move resource in state

Rename or move a resource without destroying it

terraform state mv 'aws_instance.web' 'module.app.aws_instance.web'

tool
terraform43 commands
tags
terraform

More terraform commands

  • terraform import 'aws_s3_bucket.mybucket' my-existing-bucket

    Bring an existing resource under Terraform management

  • terraform taint 'aws_instance.web[0]'

    Mark resource to be destroyed and recreated on next apply

  • terraform state rm 'aws_instance.legacy'

    Remove a resource from state without destroying it in the cloud

  • terraform output -json | jq 'to_entries[] | {(.key): .value.value}'

    Print all outputs as compact JSON

  • terraform destroy -target='aws_instance.web' -auto-approve

    Destroy a single resource without full plan

all 43 terraform commands