HashiCorp Certified: Terraform Associate — Question 104

While deploying a virtual machine, the first launch user_data script fails due to race condition with another resource deployed during the same Terraform run.

What is the least disruptive method to correct the issue?

Answer options

Correct answer: A

Explanation

The correct answer is A because using terraform taint marks the resource for recreation, allowing it to be correctly configured without disrupting other resources. Option B is not ideal as it does not address the underlying Terraform state, while C may not resolve the issue due to the race condition persisting. Option D is overly disruptive as it involves destroying the entire virtual machine, which is unnecessary for this situation.