What's the difference between terraform plan and apply, and why always plan first?
⚡
Quick Answer
plan computes and shows the change set without modifying anything; apply executes it. Reviewing the plan prevents surprises.
Detailed Answer
plan diffs desired config against state and shows creates/updates/destroys. Reviewing it (ideally in a PR) catches accidental destroys before they happen. apply then makes those exact changes. In CI, save the plan (-out) and apply that saved plan so what you reviewed is what runs.
💡
Interview Tip
Mention -out to apply the exact reviewed plan.
terraformplanapply