What happens to the...
 
Notifications
Clear all

What happens to the resource?

1 Posts
1 Users
0 Likes
274 Views
(@burlandeldridge)
Noble Member
Joined: 2 years ago
Posts: 713
Topic starter  

During a terraform apply, a resource is successfully created but eventually fails during provisioning.

What happens to the resource?

  • A . The resource will be planned for destruction and recreation upon the next terraform apply
  • B . Terraform will retry to provision again.
  • C . The failure of provisioner will be ignored and it will not cause a failure to terraform apply
  • D . The resource will be automatically destroyed.

Show Answer Hide Answer

Suggested Answer: A

Explanation:

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.

You can change this behavior by setting the on_failure attribute, which is covered in detail below.

https://www.terraform.io/docs/provisioners/index.html#creation-time-provisioners

https://www.terraform.io/docs/provisioners/index.html#destroy-time-provisioners

https://www.terraform.io/docs/provisioners/index.html#failure-behavior

   
Quote

Latest HashiCorp TA-002-P Dumps Valid Version

Latest And Valid Q&A | Instant Download | Once Fail, Full Refund
Share: