What is the effect of tainting a resource in Terraform?

Prepare for the HashiCorp Terraform Associate Exam with quizzes, flashcards, and multiple-choice questions. Each question includes hints and explanations. Boost your confidence and ace your exam!

Multiple Choice

What is the effect of tainting a resource in Terraform?

Explanation:
Tainting a resource marks it as tainted in Terraform’s state, signaling that the current instance should be replaced. When you run the next apply, Terraform will plan to destroy the existing resource and create a new one to satisfy the configuration. This is useful when a resource is in a bad or drifted state and needs to be rebuilt from scratch. It isn’t an immediate deletion, and it doesn’t upgrade versions or export to remote state. If you change your mind, you can untaint it to cancel the planned replacement.

Tainting a resource marks it as tainted in Terraform’s state, signaling that the current instance should be replaced. When you run the next apply, Terraform will plan to destroy the existing resource and create a new one to satisfy the configuration. This is useful when a resource is in a bad or drifted state and needs to be rebuilt from scratch. It isn’t an immediate deletion, and it doesn’t upgrade versions or export to remote state. If you change your mind, you can untaint it to cancel the planned replacement.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy