Which statement describes the timing of state updates in Terraform when planning or applying changes?

Prepare for the HashiCorp Terraform Associate Exam with quizzes, flashcards, and multiple-choice questions. Each question includes hints and explanations. Boost your confidence and ace your exam!

Multiple Choice

Which statement describes the timing of state updates in Terraform when planning or applying changes?

Explanation:
Terraform keeps a state file that represents your real infrastructure. Before planning changes, it refreshes that state from the actual resources so the plan is based on what exists now. After a successful apply, it writes the updated state back to the state file (or backend) to reflect the new reality. So state updates occur as part of the next plan (via refresh) and are definitely written during the apply. That's why this description matches how Terraform manages state: it is updated during the plan phase to reflect current reality, and then updated again after applying changes to record the new reality.

Terraform keeps a state file that represents your real infrastructure. Before planning changes, it refreshes that state from the actual resources so the plan is based on what exists now. After a successful apply, it writes the updated state back to the state file (or backend) to reflect the new reality. So state updates occur as part of the next plan (via refresh) and are definitely written during the apply. That's why this description matches how Terraform manages state: it is updated during the plan phase to reflect current reality, and then updated again after applying changes to record the new reality.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy