CertLumen

HashiCorp Terraform Associate (004) · Section 3 · 12% of the exam

Apply changes to infrastructure with Terraform

One of the objectives of the HashiCorp Certified: Terraform Associate (004) exam, in the section “Core Terraform workflow”. Here is what it covers, the points to remember and a question to try.

What it covers

Validate catches configuration mistakes without contacting any provider. Plan refreshes state and shows exactly what would change, and apply carries the plan out. This lesson covers how to read plan output, the planning modes and options, saved plans, and what happens when an apply fails.

Points to remember

  • validate checks syntax and internal consistency, needs init (-backend=false is enough) and never contacts providers or backends.
  • plan refreshes state, compares it with the configuration and proposes changes without applying them.
  • Plan symbols: + create, - destroy, ~ update in place, -/+ replace (destroy then create), +/- replace (create then destroy), <= read.
  • Planning modes: normal, -destroy, -refresh-only. -replace recreates one resource; -target is for exceptional cases.
  • plan -out saves a plan; apply FILE runs it without a prompt and rejects it if state changed (stale plan).

Try a question

A reviewer asks what terraform plan does to the real infrastructure when it runs. Which answer is correct?

  1. ANothing is created, changed or destroyed; it only previews what apply would do
  2. BIt creates new resources that are missing but does not delete or modify existing ones
  3. CIt applies the changes after asking for approval and then updates the state
  4. DIt formats the files, validates them and then updates the state
Show the answer

A. Plan refreshes state, compares the configuration with it and proposes operations. Only apply carries them out.

Written for practice in the style of the exam: never a question from the real exam.

In the course

The lesson Validate, plan and apply teaches this objective (about 45 minutes), and 21 practice questions test it. The course has lessons, exam-style questions, timed practice exams and an AI tutor for every objective, and a pass prediction that tells you when you're ready to book.

More in this section

← Previous objective · All 37 objectives · Next objective →