Terraform Associate Exam QuestionsBrowse all questions from this exam

Terraform Associate Exam - Question 180


If a Terraform creation-time provisioner fails, what will occur by default?

Show Answer
Correct Answer: C

If a Terraform creation-time provisioner fails, the resource is marked as tainted. This ensures that any resource potentially left in an incomplete or unstable state due to the failure will be destroyed and recreated during the next terraform apply. Tainting a resource helps maintain the desired state by ensuring that partially configured resources are not left in the infrastructure.

Discussion

3 comments
Sign in to comment
BurakkoOption: C
Mar 2, 2024

If a creation-time provisioner fails, the resource is marked as tainted. A tainted resource will be planned for destruction and recreation upon the next terraform apply .

jednorozec2022
Mar 22, 2024

C ref https://www.terraform.io/language/resources/provisioners/syntax#creation-time-provisioners

mamoon_malta2022
Sep 4, 2024

Answer C: If a creation-time provisioner fails, the resource is marked as tainted. A tainted resource will be planned for destruction and recreation upon the next terraform apply. Terraform does this because a failed provisioner can leave a resource in a semi-configured state. Because Terraform cannot reason about what the provisioner does, the only way to ensure proper creation of a resource is to recreate it. This is tainting.

tabkarOption: C
Nov 7, 2024

"If a creation-time provisioner fails, the resource is marked as tainted." https://developer.hashicorp.com/terraform/language/resources/provisioners/syntax