Run a refresh-only plan (find drift)

Compare state with the real infrastructure without proposing changes; shows drift made outside Terraform

terraform plan -refresh-only

tool
terraform43 commands
tags
terraformmonitoringtroubleshooting

More terraform commands

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

    Move state to a new backend; use -reconfigure to skip the migration and reset the backend settings

  • terraform output -json | jq -r '.endpoints.value[]'

    Pipe machine-readable outputs to jq for scripts and other tools

  • TF_LOG=DEBUG TF_LOG_PATH=tf.log terraform plan

    Write provider and API debug logs to a file; TRACE is the most verbose level

  • terraform plan -var-file=prod.tfvars -out=plan.tfplan

    Show the changes and save the plan to a file, so CI applies exactly this plan

  • terraform apply plan.tfplan

    Apply exactly the plan you generated before, without interactive prompts

all 43 terraform commands