Terraform Associate Exam QuestionsBrowse all questions from this exam

Terraform Associate Exam - Question 237


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

Show Answer
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

6 comments
Sign in to comment
Oleg_golOption: D
Nov 6, 2023

D. terraform state list

Spandrop
Jun 14, 2024

why terraform plan would refresh the state file?

Spandrop
Jun 14, 2024

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

Blitz123
Jul 28, 2024

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.

Pete987
Feb 23, 2024

A: terraform apply

Pete987
Feb 23, 2024

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

vindi135Option: D
May 26, 2024

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