TA-002-P · Question #302
True or False. The terraform refresh command is used to reconcile the state Terraform knows about (via its state file) with the real-world infrastructure. If drift is detected between the real-world i
The correct answer is A. False. The terraform refresh command updates the state file to reflect real-world infrastructure changes but does not modify the infrastructure itself.
Question
True or False. The terraform refresh command is used to reconcile the state Terraform knows about (via its state file) with the real-world infrastructure. If drift is detected between the real-world infrastructure and the last known-state, it will modify the infrastructure to correct the drift.
Options
- AFalse
- BTrue
How the community answered
(28 responses)- A89% (25)
- B11% (3)
Why each option
The `terraform refresh` command updates the state file to reflect real-world infrastructure changes but does not modify the infrastructure itself.
The `terraform refresh` command is designed to detect and report configuration drift by updating the Terraform state file to match the current actual state of resources. It does not apply any changes or modify infrastructure resources to correct detected drift; its role is solely to update the state file.
`terraform refresh` only updates the state file to reflect infrastructure changes, it does not modify the infrastructure to correct drift.
Concept tested: Terraform refresh command behavior
Source: https://developer.hashicorp.com/terraform/cli/commands/refresh
Topics
Community Discussion
No community discussion yet for this question.