HashiCorp Certified: Terraform Associate — Question 308
What does terraform destroy do?
Answer options
- A. Destroy all infrastructure in the Terraform state file
- B. Destroy all Terraform code files in the current directory while leaving the state file intact
- C. Destroy all infrastructure in the configured Terraform provider
- D. Destroy the Terraform state file while leaving infrastructure intact
Correct answer: A
Explanation
The correct answer is A because the terraform destroy command is specifically designed to remove all resources defined in the Terraform state file. Option B is incorrect as it refers to deleting code files instead of infrastructure. Option C is misleading since it suggests destruction of resources tied to the provider without mentioning the state file. Option D incorrectly states that the state file can be removed while leaving the infrastructure intact, which is not the purpose of the command.