0
0
Terraformcloud~5 mins

Why provisioners run scripts on resources in Terraform - Quick Recap

Choose your learning style9 modes available
Recall & Review
beginner
What is the main purpose of provisioners in Terraform?
Provisioners run scripts or commands on resources after they are created to perform setup tasks that Terraform itself cannot do directly.
Click to reveal answer
beginner
When do provisioners run in the Terraform lifecycle?
Provisioners run after the resource is created but before Terraform marks the resource as successfully created.
Click to reveal answer
beginner
Why might you use a provisioner to run a script on a virtual machine resource?
To install software, configure settings, or start services that Terraform cannot manage directly through its resource definitions.
Click to reveal answer
intermediate
What is a common risk when using provisioners in Terraform?
If the script run by a provisioner fails, the entire resource creation can fail, causing deployment issues.
Click to reveal answer
intermediate
How do provisioners help bridge gaps in Terraform's resource management?
They allow running custom scripts or commands on resources to handle tasks Terraform resources don’t support natively.
Click to reveal answer
When do Terraform provisioners run their scripts?
ABefore Terraform plan runs
BBefore the resource is created
CAfter Terraform destroy
DAfter the resource is created
What is a typical use case for a Terraform provisioner?
ADefining the resource type
BWriting Terraform configuration files
CInstalling software on a new server
DDestroying resources
What happens if a provisioner script fails during resource creation?
AResource creation fails
BTerraform ignores the failure
CTerraform retries indefinitely
DResource is destroyed automatically
Why might you avoid using provisioners when possible?
AThey are faster than native resources
BThey can cause deployment failures if scripts fail
CThey are required for all resources
DThey replace Terraform resource definitions
Which of these is NOT a reason to use a provisioner?
ATo manage resource lifecycle natively
BTo run custom setup scripts on a resource
CTo configure software after resource creation
DTo perform tasks Terraform resources can't do
Explain why Terraform provisioners run scripts on resources and when this happens in the resource lifecycle.
Think about what Terraform can’t do by itself and when the resource is ready.
You got /3 concepts.
    Describe the risks and best practices when using provisioners in Terraform.
    Focus on what can go wrong and how to avoid problems.
    You got /4 concepts.