Move resource in state terraform
Rename or move a resource without destroying it
terraform state mv 'aws_instance.web' 'module.app.aws_instance.web'
more terraform
all 43 commands →
Import existing resource
terraform import 'aws_s3_bucket.mybucket' my-existing-bucket
Taint resource for recreation
terraform taint 'aws_instance.web[0]'
Remove resource from state
terraform state rm 'aws_instance.legacy'
Show outputs
terraform output -json | jq 'to_entries[] | {(.key): .value.value}'
Destroy specific resource
terraform destroy -target='aws_instance.web' -auto-approve