HashiCorp Certified: Terraform Associate (004) — Question 2

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

Answer options

Correct answer: D

Explanation

The correct answer is D because Terraform automatically detects changes in the infrastructure during the next apply and updates the state accordingly. Option A is incorrect as import is used for bringing existing resources into Terraform management, not for reflecting manual deletions. Option B is not recommended since directly modifying the state file can lead to inconsistencies. Option C would not achieve the intended result, as it does not automatically remove the resources from the state.