Replace resource (modern taint)

Force destroy+recreate of one resource; replaces deprecated terraform taint

terraform apply -replace='aws_instance.web'

tool
terraform43 commands
tags
terraformtroubleshootingcloud

More terraform commands

  • 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-only

    Sync state to real infra without proposing changes; surfaces out-of-band drift

  • terraform init -migrate-state -backend-config=backend.hcl

    Move 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

  • TF_LOG=DEBUG TF_LOG_PATH=tf.log terraform plan

    Capture provider/API debug to a file; use TRACE for the most verbose level

all 43 terraform commands