HashiCorp Certified: Terraform Associate — Question 54

You have never used Terraform before and would like to test it out using a shared team account for a cloud provider. The shared team account already contains
15 virtual machines (VM). You develop a Terraform configuration containing one VM, perform terraform apply, and see that your VM was created successfully.
What should you do to delete the newly-created VM with Terraform?

Answer options

Correct answer: B

Explanation

The correct answer is B because the Terraform state file only tracks the resources managed by Terraform, which in this case is just the newly created VM. Option A is incorrect as it implies all VMs are tracked, which is not the case. Option C is wrong since deleting the state file would remove all tracking of the resources. Option D would lead to a mismatch between the cloud provider's resources and the Terraform state, making it an improper method for managing the VM.