3.3.2. terraform apply
💡 First Principle: apply is the single command that changes real infrastructure — and it deliberately makes you approve the plan first — so the friction of confirmation is the system protecting you from unreviewed change.
terraform apply carries out the actions needed to reach your desired state. Without a saved plan, it first generates a plan, displays it, and prompts for confirmation (yes) before proceeding. After making changes via providers, it updates the state file to reflect the new reality.
Key behaviors and flags: -auto-approve skips the interactive prompt (common in CI, risky interactively); apply tfplan applies a previously saved plan with no prompt; -target=... limits apply to specific resources (a troubleshooting tool, not routine practice); and -parallelism=n adjusts how many resources Terraform operates on concurrently.
⚠️ Exam Trap: Two facts trip people up. First, apply updates state — it's the command that records new resource IDs. Second, apply tfplan (a saved plan) does not prompt, because approval is implied by having reviewed the saved plan. Watch for answers conflating -auto-approve with saved-plan behavior.
Reflection Question: After a successful apply, what has changed besides your real infrastructure — and why does that matter for the next plan?