HashiCorp Terraform Associate (004) exam dumps

HashiCorp Terraform Associate (004) practice question 23 of 223

Terraform Associate 004. Associate level, HashiCorp. Free question with the correct answer and a full explanation.

HashiCorp Terraform Associate (004) Question 23

Single answer2 Terraform fundamentals

A platform team stores its Terraform configuration in Git and wants every engineer to review the exact infrastructure changes before anything is applied. During testing, one engineer runs terraform plan in the morning, another engineer changes a variable value in terraform.tfvars before lunch, and a third engineer runs terraform apply in the afternoon without any additional arguments. The team notices that the applied changes do not match the morning review. Which action should the team take to ensure Terraform applies exactly the reviewed execution plan?

  1. A

    Run terraform refresh immediately before terraform apply so the reviewed changes are preserved

  2. B

    Save the plan with terraform plan -out=tfplan and later run terraform apply tfplan

  3. C

    Run terraform apply -auto-approve right after reviewing the plan output in the terminal

  4. D

    Set TF_LOG=TRACE during terraform apply so Terraform uses the same decisions made during terraform plan

Show answer and explanation

Correct answer: B

Explanation

Terraform fundamentals include understanding the difference between speculative plans shown in the terminal and saved execution plans. When you run terraform plan without -out, the result is only displayed for review and is not persisted for later application. A later terraform apply without a plan file creates a fresh plan using the current configuration, variables, and state, so the actions may differ from what was originally reviewed. To ensure the applied changes exactly match the reviewed plan, generate a saved plan with terraform plan -out=tfplan and then apply that file with terraform apply tfplan. This aligns with Terraform CLI workflow guidance in HashiCorp documentation on plan and apply, and is a common best practice in team-based review and approval workflows.

  • A. Incorrect.

    Incorrect. terraform refresh updates Terraform's view of real infrastructure state, but it does not preserve or lock in a previously reviewed execution plan. If configuration files, variables, or state have changed, a later terraform apply without a saved plan will recalculate actions and may produce different changes.

  • B. Correct.

    Correct. Saving the plan to a file with terraform plan -out=tfplan creates an execution plan artifact that can be reviewed and then applied later with terraform apply tfplan. This is the standard way to ensure Terraform applies exactly the set of actions that were reviewed, assuming the plan is still valid at apply time.

  • C. Incorrect.

    Incorrect. -auto-approve only skips the interactive approval prompt. It does not guarantee that the actions being applied match an earlier reviewed plan. If terraform apply is run without a saved plan file, Terraform generates a new plan before applying, which can differ from the earlier terminal output.

  • D. Incorrect.

    Incorrect. TF_LOG=TRACE enables verbose logging for troubleshooting. It has no effect on whether Terraform reuses a prior plan or applies the exact previously reviewed changes. This option reflects a common misconception that logging settings influence execution behavior.

Timed practice exam

Take a HashiCorp Terraform Associate (004) practice test under exam conditions

70 questions in 60 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam