TA-002-P · Question #60
TA-002-P Question #60: Real Exam Question with Answer & Explanation
The correct answer is C: State file drift. The 'terraform refresh' command is used to reconcile the Terraform state file with the actual infrastructure deployed in the cloud or on-premises. It detects and updates the state file to reflect any changes made to resources outside of Terraform's management.
Question
What is terraform refresh intended to detect?
Options
- ATerraform configuration code changes
- BEmpty state files
- CState file drift
- DCorrupt state files
Explanation
The 'terraform refresh' command is used to reconcile the Terraform state file with the actual infrastructure deployed in the cloud or on-premises. It detects and updates the state file to reflect any changes made to resources outside of Terraform's management.
Common mistakes.
- A. 'terraform plan' or 'terraform apply' detect configuration code changes by comparing the new configuration with the state file.
- B. 'terraform refresh' operates on an existing state file and doesn't directly detect empty state files, though it might result in an empty state if no resources are found.
- D. 'terraform refresh' does not validate the integrity of the state file's format; other commands or manual inspection would be needed for corrupt state files.
Concept tested. Terraform refresh command purpose
Reference. https://developer.hashicorp.com/terraform/cli/commands/refresh
Topics
Community Discussion
No community discussion yet for this question.