Terraform Associate Exam QuestionsBrowse all questions from this exam

Terraform Associate Exam - Question 301


What Terraform command always causes a state file to be updated with changes that might have been made outside of Terraform?

Show Answer
Correct Answer: A

The 'terraform plan -refresh-only' command updates the state file with the current state of resources in the real world, without performing any changes. It ensures that the state file reflects any changes made outside of Terraform, providing an accurate comparison between the Terraform configurations and the actual infrastructure.

Discussion

8 comments
Sign in to comment
Stargazer11
Nov 27, 2023

Neither one of them is correct. Should be terraform apply -refresh-only

[Removed]Option: A
Dec 29, 2023

A - terraform plan -refresh-only

dev_maftuna
Dec 1, 2023

A. The -refresh-only flag with the terraform plan command updates the state file with the current state of the real resources, without applying any changes. This command compares the current state of the infrastructure with the Terraform configuration and updates the state file with any changes that were made externally.

vindi135Option: A
Nov 26, 2023

A. is the closest answer but not quite the right command that would make the changes to the state file. Its terraform apply -refresh-only

petersolimanOption: A
Nov 25, 2023

A is the correct answer

kareem_ashraf
Nov 26, 2023

non is correct , some thing maybe wrong with this question , should be terraform refresh i think

Mattt
Sep 17, 2024

terraform apply -refresh-only

dev_maftuna
Dec 6, 2023

A. terraform plan -refresh-only

090200fOption: A
Aug 5, 2024

option A is correct