When you modify a resource in Azure Portal that is managed by Terraform, when does Terraform reflect that change in its state?

Prepare for the HashiCorp Terraform Associate Exam. Utilize flashcards and multiple-choice questions with detailed hints and explanations. Boost your confidence and be ready for success!

Multiple Choice

When you modify a resource in Azure Portal that is managed by Terraform, when does Terraform reflect that change in its state?

Explanation:
Terraform tracks resources in a state file and only learns about outside changes when it refreshes that state. If you tweak a resource in Azure Portal, Terraform’s view becomes out of sync. When you run the next plan (or apply), Terraform refreshes its state by querying Azure for the current attributes of the resource. This refresh updates the in-memory state to reflect the real-world resource, and the plan will show any drift. When you then apply, the state file itself is updated to match the actual resource, bringing everything back into alignment. So the change is reflected the next time you run plan or apply.

Terraform tracks resources in a state file and only learns about outside changes when it refreshes that state. If you tweak a resource in Azure Portal, Terraform’s view becomes out of sync. When you run the next plan (or apply), Terraform refreshes its state by querying Azure for the current attributes of the resource. This refresh updates the in-memory state to reflect the real-world resource, and the plan will show any drift. When you then apply, the state file itself is updated to match the actual resource, bringing everything back into alignment. So the change is reflected the next time you run plan or apply.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy