TERRAFORM-ASSOCIATE-004 · Question #54
What Terraform command always causes a state file to be updated with changes that might have been made outside of Terraform?
The correct answer is A. terraform plan -refresh-onlyly. terraform plan -refresh-only (formerly terraform refresh) causes Terraform to query the actual current state of all managed resources and update the state file to match reality - without making any infrastructure changes. This is useful when resources have been modified outside…
Question
Options
- Aterraform plan -refresh-onlyly
- Bterraform show -json
- Cterraform apply -lock-false
- Dterraform plan -target-state
How the community answered
(27 responses)- A93% (25)
- B4% (1)
- C4% (1)
Explanation
terraform plan -refresh-only (formerly terraform refresh) causes Terraform to query the actual current state of all managed resources and update the state file to match reality - without making any infrastructure changes. This is useful when resources have been modified outside of Terraform (configuration drift). The -refresh-only flag was introduced in Terraform 0.15.4 as a safer replacement for the standalone terraform refresh command, which is now deprecated.
Topics
Community Discussion
No community discussion yet for this question.