Domain 3 of 8 · Chapter 4 of 7

Generate and review an execution plan

Unlock the complete study guide + 1,040 practice questions across 16 full exams.

Bundled into the existing HashiCorp Certified: Terraform Associate premium course — no separate purchase.

14-day money-back guarantee — no questions asked.

Included in this chapter:

  • What a plan is: refresh, compare, propose
  • Reading a plan: action symbols and the summary
  • Planning modes and refresh, scope, and replace flags
  • Saved plans and detailed exit codes
  • Exam-pattern recognition

Planning invocations and how each reshapes refresh, compare, propose

BehaviorDefault plan-refresh-only-refresh=false-replace=ADDR-target=ADDR
Refreshes state firstYesYes, only thisNoYesYes
Proposes config changesYesNoYesYes, forces recreateYes, scoped
Scope of planningAll resourcesState and outputsAll resourcesOne instance + depsTarget + deps
Typical useEvery changeAccept external driftFaster re-planForce recreationExceptional recovery

Decision tree

Just reviewing a change?Only reconcile drift?Force a rebuild?Isolate one resource?terraform plandefault preview-refresh-onlyreconcile state only-replace=ADDRESSdestroy and recreate-target=ADDRESSexceptional recoveryterraform plandefault full planAlways: -out saves an exact apply; -detailed-exitcode gates CIYesYesYesYesNoNoNoNo

Cheat sheet

  • plan refreshes, compares, then proposes
  • plan does not carry out changes
  • Reading plan action symbols and the Plan summary line
  • -refresh=false skips the state refresh
  • -refresh-only only reconciles state
  • -target and -replace narrow or force actions
  • -replace flag replaces deprecated taint/untaint
  • -out saves a plan for exact apply
  • Saved plan files store sensitive data in cleartext
  • -detailed-exitcode signals diff state

Unlock with Premium — includes all practice exams and the complete study guide.

Also tested in

References

  1. Command: terraform plan
  2. Create and review a Terraform execution plan (tutorial)
  3. Command: terraform taint (deprecated; use -replace)
  4. Command: terraform apply