terraform apply

Apply Terraform changes to provision or update infrastructure.

high risk

interactive breakdown — edit the command and press Explain
$ 
⚠ Risks & cautions
Safer / dry-run alternatives
terraform plan -out=tfplanCreate a saved plan and review it.
terraform apply tfplanApply exactly the plan you reviewed.
What it does

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.

Common flags
FlagMeaning
-auto-approveSkip interactive approval (for CI/CD)
-targetApply only specific resources
-varSet variable values
-refresh=falseSkip state refresh (faster, use with caution)
Examples
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 →
Pro tip

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.

Related
terraform plan terraform init kubectl apply
Open the full explainer →More in Terraform, Ansible & IaC

Reference text is hand-written and may be incomplete — check man terraform for your version. Test destructive commands on a non-production system first.