During a terraform apply, a resource is successfully created but eventually fails during provisioning.
What happens to the resource?
A . Terraform attempts to provide the resource up to three times before exiting with an error
B . the terraform plan is rolled back and all provisioned resources are removed
C . it is automatically deleted
D . the resource is marked as tainted
Answer: D
Explanation:
If a resource successfully creates but fails during provisioning, Terraform will error and mark the resource as "tainted". A resource that is tainted has been physically created, but can’t be considered safe to use since provisioning failed.
Terraform also does not automatically roll back and destroy the resource during the apply when the failure happens, because that would go against the execution plan: the execution plan would’ve said a resource will be created, but does not say it will ever be deleted.
Leave a Reply