HashiCorp Certified: Terraform Associate — Question 179

If you manually destroy infrastructure, what is the best practice reflecting this change in Terraform?

Answer options

Correct answer: B

Explanation

The correct answer is B because removing the resource definition and using 'terraform apply -refresh-only' ensures that Terraform accurately reflects the current state of the infrastructure. Option A is incorrect as manually altering the state file can lead to inconsistencies. Option C does not apply here since 'terraform import' is used to bring existing resources under Terraform management, not for reflecting deletions. Option D is also incorrect because manual changes do not automatically sync with Terraform.