Exam Terraform Associate All QuestionsBrowse all questions from this exam
Question 272

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

    Correct Answer: A, D

    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 because Terraform does a refresh which updates the metadata in the state file. However, if changes are made outside Terraform's control, such as directly via the Azure Cloud Console, these changes do not automatically update the Terraform state file. Terraform must refresh and recognize the external changes during the next plan or apply cycle to update the state file accordingly.

Discussion
Jas14Options: AD

AD is the correct answer

Tronko86Option: D

Only D

ogerberOptions: AD

100% 2 answers are required

dankositzkeOption: D

Should not be a “choose two” because (D) is the only answer.

AkaAka4

Refer to an earlier question #98. Answer should be A and D. I honestly suggest anyone who is not that knowledgeable (like me) to not be over-confident and mislead others. Thank you.

azurebot123

Yes if you refer to an earlier question #19. Answer should be AD only. LOL I hope you didn't look up Q19. Okay, reasons I'm not sure about A: - you change a Terraform-managed resource via the Azure Cloud Console, - when you run Terraform plan or apply, Terraform will first do a refresh and update the metadata to what you've changed in cloud console. BUT Terraform will subsequently start applying what's in the config file and revert the change you've made via cloud console. Finally it updates the state file with what's in terraform config.

azurebot123

oh look i cleared my own doubt - reason why it's A: terraform plan or terraform apply without approval is basically a terraform state refresh. State file will be updated with the changes made on cloud console.

SpandropOption: D

Only D is the correct one, Terraform will never update the state file to reflect changes that occurred in the environment manually (outside Terraform), it will do the opposity, if the your code is not updated accordingly with what was manually changed, Terraform will bring your environment back to what it is in the state file.

nuridgsnOption: D

A. It is not correct, terraform plan doesn't reflect the changes, it only shows the changes to you when you run terraform apply it reflects the change. B. When you do manual change in resource, Terraform doesn't imply changes automatically C. Terraform never creates a new state file for the new changes and it uses the existing one unless you don't specify a different backend. D. Correct. You can only update tfstate file with either terraform apply (suggested) or terraform apply -refresh-only (not suggested though). Option A has probably typo issue, terraform plan shouldn't be in there.

DevoteamAnalytixOptions: AD

For me B and C is wrong, so it's A and D