Which of the following is not a way to trigger terraform destroy?

Prepare for the HashiCorp Terraform Associate Exam with quizzes, flashcards, and multiple-choice questions. Each question includes hints and explanations. Boost your confidence and ace your exam!

Multiple Choice

Which of the following is not a way to trigger terraform destroy?

Explanation:
The concept being tested is what actions actually cause Terraform to remove resources versus those that only prepare or complicate the process. Destruction happens when Terraform is explicitly instructed to remove managed resources, either by running the destroy command, or by creating a plan that includes destroy actions and then applying that plan, or by running destroy in an interactive mode and confirming. Deleting the state file and then running apply does not trigger destruction. Terraform relies on the state to know what resources exist and what to remove. If the state is deleted, Terraform can’t determine which resources are managed or what to destroy, so applying will try to converge the configuration with the real world in an unpredictable way—often leading to resource creation or errors—rather than removing existing resources. That makes this action not a valid way to trigger destruction. In contrast, using the destroy command with auto-approve directly removes resources, planning with a destroy flag shows what would be destroyed (and can be followed by apply to execute), and running destroy from the correct directory with a confirmation actually performs the destruction.

The concept being tested is what actions actually cause Terraform to remove resources versus those that only prepare or complicate the process. Destruction happens when Terraform is explicitly instructed to remove managed resources, either by running the destroy command, or by creating a plan that includes destroy actions and then applying that plan, or by running destroy in an interactive mode and confirming.

Deleting the state file and then running apply does not trigger destruction. Terraform relies on the state to know what resources exist and what to remove. If the state is deleted, Terraform can’t determine which resources are managed or what to destroy, so applying will try to converge the configuration with the real world in an unpredictable way—often leading to resource creation or errors—rather than removing existing resources. That makes this action not a valid way to trigger destruction.

In contrast, using the destroy command with auto-approve directly removes resources, planning with a destroy flag shows what would be destroyed (and can be followed by apply to execute), and running destroy from the correct directory with a confirmation actually performs the destruction.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy