Migrate backend on init

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

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

tool
terraform43 commands
tags
terraformgitopstroubleshooting

More terraform commands

  • 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

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

    Show changes; save plan artifact for CI gating

  • terraform apply plan.tfplan

    Apply exactly the previously generated plan — no interactive prompts

  • terraform import module.path.resource_type.name <remote-id>

    Bring an already-existing resource under Terraform control

all 43 terraform commands