Apply Terraform changes to provision or update infrastructure.
high risk
terraform plan -out=tfplanCreate a saved plan and review it.terraform apply tfplanApply exactly the plan you reviewed.terraform apply executes the changes shown by terraform plan. Without -auto-approve, it shows the plan and waits for confirmation. When passed a saved plan file, it applies exactly that plan. Changes are recorded in the state file.
| Flag | Meaning |
|---|---|
-auto-approve | Skip interactive approval (for CI/CD) |
-target | Apply only specific resources |
-var | Set variable values |
-refresh=false | Skip state refresh (faster, use with caution) |
terraform apply tfplanApply a pre-generated plan file · explain & risk-check →terraform apply -auto-approve -var-file=prod.tfvarsCI/CD apply with auto-approval · explain & risk-check →terraform apply -target=aws_security_group.webApply only specific resource · explain & risk-check →Never use `-auto-approve` without a saved plan file (`-auto-approve tfplan`) in production — always know exactly what you're auto-approving. Save the plan, review it, then apply it.
Reference text is hand-written and may be incomplete — check man terraform for your version. Test destructive commands on a non-production system first.