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

Select the command that doesn’t cause Terraform to refresh its state.

    Correct Answer: D

    The command 'terraform state list' does not cause Terraform to refresh its state. This command is used to list the resources within the state file, without performing any operations that would modify or refresh the state. On the other hand, commands like 'terraform apply', 'terraform destroy', and 'terraform plan' interact with both the state and the actual resources, causing Terraform to refresh its state to ensure the configuration is aligned with the current infrastructure.

Discussion
Oleg_golOption: D

D. terraform state list

SpandropOption: C

why terraform plan would refresh the state file?

Spandrop

got it, it is not about the state file. This kind of question is not about technical skill, but reading skill instead.

Blitz123Option: D

again a poorly framed question "Terraform to refresh its state" the obvious answer is "D" but "terraform plan" command does not refresh it's states. it reads state file and it compares the configuration against the current state stored in the Terraform state file. It identifies the differences between what is declared in the configuration and what currently exists in the infrastructure. but it in any shape of form it does not refresh the state these kind of questions confuses people. terraform plan is a read-only command if we see from state file point of view, but there are certain aspects, such as we not be running terraform plan when there is a state lock.

vindi135Option: D

...or C are both not updating the state.

Pete987Option: D

sorry, my bad - didn't read the question well. Answer is D

Pete987Option: A

A: terraform apply