If a Terraform creation-time provisioner fails, what will occur by default?
If a Terraform creation-time provisioner fails, what will occur by default?
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.
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 .
C ref https://www.terraform.io/language/resources/provisioners/syntax#creation-time-provisioners
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.
"If a creation-time provisioner fails, the resource is marked as tainted." https://developer.hashicorp.com/terraform/language/resources/provisioners/syntax