Bitzu

Terraform Associate 004 ยท Core Terraform workflow

Generating and reading a plan

Refresh, diff against state, plan symbols (+ - ~ -/+), the summary line, -out saved plans, speculative plans (3d).

Key points

  • terraform plan: compares configuration with refreshed state, proposes actions without performing them.
  • Symbols: + create, - destroy, ~ update in place, -/+ destroy and recreate (replace).
  • Summary line: resources to add, change, destroy.
  • out=FILE: saves the plan for terraform apply FILE; may hold sensitive values in cleartext.
  • Speculative plans: preview changes, e.g. on pull requests.

Source: https://developer.hashicorp.com/terraform/cli/commands/plan

Practice questions

Single choice

Which plan symbol means a resource will be updated in place?

  1. +
  2. ~
  3. -/+
  4. -
Show answer

Answer: B. ~

~ marks an in-place update. + is create, - is destroy, and -/+ is destroy then recreate.

Select all that apply

Which statements about a saved plan file (-out) are correct?

  1. It can later be passed to terraform apply
  2. It is safe to publish because secrets are always encrypted in it
  3. It may contain sensitive values in cleartext
  4. You can hand-edit it to change the proposed actions
  5. Applying it re-reads configuration and builds a new plan
Show answer

Answer: A. It can later be passed to terraform apply, C. It may contain sensitive values in cleartext

A saved plan is applied with terraform apply FILE, and it can hold sensitive values in cleartext so it must be protected. It is not editable and apply does not re-plan from it.

True or false

terraform plan creates and changes real resources so that it can measure the difference accurately.

Show answer

Answer: False

False. plan only proposes changes; resources change only on apply.

Practice 8 questions on this topic in Bitzu

Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.

Download on the App StoreGet it on Google Play

More Terraform Associate 004 topics in this module