ExamGecko
Question list
Search
Search

Question 132 - Terraform Associate 003 discussion

Report
Export

When using Terraform to deploy resources into Azure, which scenarios are true regarding state files? (Choose two.)

A.
When you change a Terraform-managed resource via the Azure Cloud Console, Terraform updates the state file to reflect the change during the next plan or apply
Answers
A.
When you change a Terraform-managed resource via the Azure Cloud Console, Terraform updates the state file to reflect the change during the next plan or apply
B.
Changing resources via the Azure Cloud Console records the change in the current state file
Answers
B.
Changing resources via the Azure Cloud Console records the change in the current state file
C.
When you change a resource via the Azure Cloud Console, Terraform records the changes in a new state file
Answers
C.
When you change a resource via the Azure Cloud Console, Terraform records the changes in a new state file
D.
Changing resources via the Azure Cloud Console does not update current state file
Answers
D.
Changing resources via the Azure Cloud Console does not update current state file
Suggested answer: A, D

Explanation:

Terraform state is a representation of the infrastructure that Terraform manages. Terraform uses state to track the current status of the resources it creates and to plan future changes. However, Terraform state is not aware of any changes made to the resources outside of Terraform, such as through the Azure Cloud Console, the Azure CLI, or the Azure API. Therefore, changing resources via the Azure Cloud Console does not update the current state file, and it may cause inconsistencies or conflicts with Terraform's desired configuration. To avoid this, it is recommended to manage resources exclusively through Terraform or to use theterraform importcommand to bring existing resources under Terraform's control.

When you change a Terraform-managed resource via the Azure Cloud Console, Terraform does not immediately update the state file to reflect the change. However, the next time you runterraform planorterraform apply, Terraform will compare the state file with the actual state of the resources in Azure and detect any drifts or differences. Terraform will then update the state file to match the current state of the resources and show you the proposed changes in the execution plan. Depending on the configuration and the change, Terraform may try to undo the change, modify the resource further, or recreate the resource entirely. To avoid unexpected or destructive changes, it is recommended to review the execution plan carefully before applying it or to use theterraform refreshcommand to update the state file without applying any changes.

Reference=Purpose of Terraform State,Terraform State,Managing State,Importing Infrastructure, [Command: plan], [Command: apply], [Command: refresh]

asked 18/09/2024
Aleksandar Jovasevic
45 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first