Refactor with moved block
Rename addresses in code with no destroy/recreate; survives in version control
cat >> moved.tf <<'EOF'
moved {
from = aws_instance.web
to = aws_instance.app
}
EOF
- tool
- terraform43 commands
More terraform commands
-
terraform apply -replace='aws_instance.web'Force destroy+recreate of one resource; replaces deprecated terraform taint
-
terraform plan -target='module.db.aws_db_instance.main'Limit plan to one address; note: -target is an escape hatch, can mask drift
-
terraform plan -refresh-onlySync state to real infra without proposing changes; surfaces out-of-band drift
-
terraform init -migrate-state -backend-config=backend.hclMove state to a new backend; use -reconfigure to skip migration and reset
-
terraform output -json | jq -r '.endpoints.value[]'Pipe machine-readable outputs into jq for scripting and downstream wiring