0
0
Terraformcloud~20 mins

Why provisioners run scripts on resources in Terraform - Challenge Your Understanding

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Terraform Provisioner Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Why do Terraform provisioners run scripts on resources?

Terraform provisioners allow you to run scripts or commands on a resource after it is created. What is the main reason for using provisioners in Terraform?

ATo configure or customize a resource immediately after creation when Terraform cannot do it natively.
BTo replace Terraform's built-in resource creation logic with custom scripts.
CTo permanently store state information outside of Terraform's state file.
DTo automatically scale resources based on load without manual intervention.
Attempts:
2 left
💡 Hint

Think about what Terraform can and cannot do by itself when creating resources.

Architecture
intermediate
2:00remaining
When should you avoid using Terraform provisioners?

Which scenario is NOT a good reason to use Terraform provisioners?

AWhen the resource supports native Terraform configuration options.
BWhen you need to run a one-time setup script after resource creation.
CWhen you want to install software on a virtual machine after it launches.
DWhen you need to execute commands that Terraform cannot perform directly.
Attempts:
2 left
💡 Hint

Consider if Terraform already supports configuring the resource without extra scripts.

service_behavior
advanced
2:00remaining
What happens if a Terraform provisioner script fails during apply?

Consider a Terraform configuration with a local-exec provisioner that runs a script on a resource. What is the behavior if the script returns a non-zero exit code?

ATerraform ignores the error and continues applying other resources.
BTerraform apply fails and marks the resource as tainted.
CTerraform marks the resource as tainted but continues the apply.
DTerraform retries the script automatically until it succeeds.
Attempts:
2 left
💡 Hint

Think about how Terraform treats errors during resource provisioning.

security
advanced
2:00remaining
What is a security risk when using Terraform provisioners to run scripts on resources?

Running scripts on resources with provisioners can introduce security risks. Which of the following is a common risk?

AProvisioners prevent unauthorized access by default through secure tunnels.
BTerraform automatically encrypts all provisioner scripts, preventing exposure.
CProvisioners isolate scripts from the resource, so no risk exists.
DEmbedding sensitive data like passwords directly in provisioner scripts or Terraform files.
Attempts:
2 left
💡 Hint

Consider how sensitive information is handled in scripts and Terraform configurations.

Best Practice
expert
3:00remaining
What is the recommended best practice regarding the use of Terraform provisioners?

Which statement best describes the recommended best practice for using Terraform provisioners?

AAvoid provisioners completely and rely only on manual post-deployment scripts.
BUse provisioners extensively to handle all configuration tasks for resources.
CUse provisioners only as a last resort when native Terraform resource features cannot achieve the desired configuration.
DUse provisioners to replace Terraform modules for better flexibility.
Attempts:
2 left
💡 Hint

Think about maintainability and reliability of infrastructure code.