What is the safest command to see all resources that will be deleted by Terraform before applying changes?

Prepare for your Terraform Associate Exam with our engaging quiz. Test your knowledge with multiple choice questions and receive detailed explanations to enhance your understanding. Ace your exam with confidence!

The command that allows you to safely view all resources that will be deleted by Terraform before applying any changes is the command that includes the 'plan' option with the destruction flag. This command generates an execution plan, showing you what changes will occur if you proceed, specifically focused on the deletion of resources.

Using the 'plan' command with the '-destroy' flag provides insight into what Terraform is set to remove without actually making any changes to your infrastructure. It allows you to verify the actions that Terraform intends to take, which can help prevent unintended consequences from occurring if you were to execute a destruction command directly.

In contrast, the 'apply -destroy' command would immediately execute the destruction of resources, which is not a safe way to preview what would happen. The 'terraform destroy' command also directly removes resources without first providing you a chance to review the planned changes. The 'refresh' command has a different purpose, as it updates the state file with the actual state of designated resources, not specifically focused on deletion or providing a plan.

This context emphasizes the importance of reviewing the planned actions, particularly when it comes to destructive changes, highlighting how the command that includes 'plan -destroy' is integral for ensuring safety and accountability in managing infrastructure with Terraform

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy