What is terraform refresh intended to detect?
What is terraform refresh intended to detect?
C
Reference:
https://www.hashicorp.com/blog/detecting-and-managing-drift-with-terraform
C. State file drift. The terraform refresh command is used to reconcile the state Terraform has stored in the state file with the real-world infrastructure. When you run terraform apply, Terraform updates the state file to reflect the current state of the infrastructure it manages. However, if changes are made to the infrastructure outside of Terraform, such as via the web console or API, the state file will become out-of-date and will not accurately reflect the current state of the infrastructure.
This command is now deprecated
C is correct
State file drift for sure
Terraform refresh is intended to detect state file drift. It updates the Terraform state file with the real-world state of the resources being managed, which allows Terraform to detect any changes that might have been made outside of Terraform. This is useful when the state file is out of sync with the actual resources in the cloud provider, which can happen if someone manually modifies a resource outside of Terraform. By running terraform refresh, Terraform can identify those differences and update the state file to reflect the real-world state of the resources being managed.
C is the closet correct answer, however this command is no longer in use. "The terraform refresh command reads the current settings from all managed remote objects and updates the Terraform state to match. Warning: This command is deprecated, because its default behavior is unsafe if you have misconfigured credentials for any of your providers. See below for more information and recommended alternatives." https://www.terraform.io/cli/commands/refresh
Answer is C
C. State file drift terraform refresh is a command in the Terraform infrastructure as code tool that is used to update the state file with the current real-world infrastructure. It compares the resources described in the state file to the actual resources in the infrastructure and updates the state file to match the infrastructure. One of the things that terraform refresh is intended to detect is state file drift, which is a difference between the infrastructure and the resources described in the state file.