nerdexam
HashiCorp

TA-002-P · Question #418

You have modified your local Terraform configuration and ran terraform plan to review the changes. Simultaneously, your teammate manually modified the infrastructure component you are working on…

The correct answer is B. False. A terraform plan snapshot reflects infrastructure state at the moment it was generated; manual changes made after that snapshot are not reflected in a subsequent apply.

Use the Terraform CLI (terraform plan, apply, destroy, fmt, init, validate, workspace, import, taint, providers, output)

Question

You have modified your local Terraform configuration and ran terraform plan to review the changes. Simultaneously, your teammate manually modified the infrastructure component you are working on. Since you already ran terraform plan locally, the execution plan for terraform apply will be the same.

Options

  • ATrue
  • BFalse

How the community answered

(34 responses)
  • A
    6% (2)
  • B
    94% (32)

Why each option

A terraform plan snapshot reflects infrastructure state at the moment it was generated; manual changes made after that snapshot are not reflected in a subsequent apply.

ATrue

True is incorrect because terraform plan output is a point-in-time snapshot; any out-of-band change to infrastructure invalidates it, and apply will recalculate based on real current state.

BFalseCorrect

When terraform apply runs, it performs a fresh refresh of the current infrastructure state before executing. If a teammate manually changed a resource after your terraform plan, the apply phase will detect the new actual state and recalculate the diff, meaning the execution plan at apply time differs from the one generated by your earlier terraform plan.

Concept tested: Terraform plan staleness and apply refresh behavior

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

Topics

#terraform plan#terraform apply#state drift#execution plan

Community Discussion

No community discussion yet for this question.

Full TA-002-P Practice