Recall & Review
beginner
What happens when a Terraform provisioner fails during resource creation?
Terraform marks the resource as tainted and stops the apply process unless you use the 'ignore_errors' option. This means the resource will be destroyed and recreated on the next apply.
Click to reveal answer
intermediate
What is the purpose of the 'on_failure' argument in Terraform provisioners?
The 'on_failure' argument controls what Terraform does if the provisioner fails. Options include 'fail' (default), 'continue', and 'warn'.
Click to reveal answer
intermediate
Explain the difference between 'fail' and 'continue' in the 'on_failure' setting.
'fail' stops the apply and marks the resource as tainted. 'continue' lets Terraform proceed even if the provisioner fails, without marking the resource as tainted.
Click to reveal answer
advanced
How can you prevent Terraform from destroying a resource if a provisioner fails?
Set 'on_failure' to 'continue' or use 'ignore_errors = true' in the provisioner block to avoid resource destruction on failure.
Click to reveal answer
beginner
Why should provisioners be used as a last resort in Terraform?
Provisioners can cause unpredictable failures and complicate resource management. It's better to use native Terraform resources or external configuration management tools.
Click to reveal answer
What does Terraform do by default if a provisioner fails?
✗ Incorrect
By default, Terraform stops the apply and marks the resource as tainted when a provisioner fails.
Which 'on_failure' option allows Terraform to continue even if the provisioner fails?
✗ Incorrect
'continue' lets Terraform proceed without marking the resource as tainted.
What is the effect of setting 'ignore_errors = true' in a provisioner?
✗ Incorrect
'ignore_errors = true' tells Terraform to ignore failures and continue the apply.
Why is it recommended to minimize the use of provisioners in Terraform?
✗ Incorrect
Provisioners can cause unpredictable failures and make resource management harder.
If a provisioner fails and 'on_failure' is set to 'warn', what happens?
✗ Incorrect
'warn' lets Terraform continue but logs a warning about the failure.
Describe how Terraform handles provisioner failures and the options to control this behavior.
Think about what happens when a script run by Terraform fails and how you can tell Terraform to react differently.
You got /3 concepts.
Explain why relying on provisioners in Terraform can be risky and what alternatives exist.
Consider how you would manage configuration without running scripts inside Terraform.
You got /3 concepts.