What does the Terraform command 'terraform apply -refresh-only' do?

Master the HashiCorp Terraform Test with these flashcards and multiple choice questions. Each question includes hints and explanations to prepare you effectively. Set yourself up for success!

The command 'terraform apply -refresh-only' is specifically designed to refresh the current state of the Terraform configuration without making any changes to the infrastructure managed by Terraform. When this command is executed, it interacts with the cloud provider's API to retrieve the latest state of the infrastructure resources and updates the local state file accordingly, ensuring that the local representation of resources is in sync with the actual cloud resources.

This is particularly useful in scenarios where you want to check if the current state of resources has changed outside of Terraform's management (for example, if someone manually modified the infrastructure). However, it will not make any new changes or modifications to resources; it merely updates the state file with the latest information.

Thus, the command effectively serves to refresh the state without altering any infrastructure, aligning with the understanding that it solely focuses on the state update aspect, not on applying any changes.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy