0
0
Terraformcloud~20 mins

Local-exec provisioner in Terraform - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Local-exec Provisioner Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
service_behavior
intermediate
2:00remaining
What is the output of this Terraform local-exec provisioner?
Given the following Terraform resource with a local-exec provisioner, what will be printed to the console when the resource is created?
Terraform
resource "null_resource" "example" {
  provisioner "local-exec" {
    command = "echo Hello from Terraform"
  }
}
ATerraform apply fails with syntax error
BError: command not found
CHello from Terraform
DNo output is printed
Attempts:
2 left
💡 Hint
The local-exec provisioner runs commands on the machine where Terraform runs.
Configuration
intermediate
2:00remaining
Which option correctly runs a shell script using local-exec provisioner?
You want to run a shell script named 'setup.sh' located in the same directory as your Terraform configuration using a local-exec provisioner. Which option correctly specifies the command?
Acommand = "./setup.sh"
Bcommand = "run setup.sh"
Ccommand = "sh ./setup.sh"
Dcommand = "bash setup.sh"
Attempts:
2 left
💡 Hint
Consider how to explicitly run a script with bash.
Architecture
advanced
2:00remaining
What is a key limitation of using local-exec provisioner in Terraform for cloud resource setup?
Which of the following best describes a limitation when using local-exec provisioner to configure cloud resources?
AIt requires the command to be run on the machine where Terraform is executed
BIt runs commands on the remote cloud resource directly
CIt automatically retries failed commands until success
DIt can only run commands written in Python
Attempts:
2 left
💡 Hint
Think about where local-exec commands actually run.
security
advanced
2:00remaining
What is a security risk when using local-exec provisioner with sensitive data?
You use local-exec provisioner to run a command that includes sensitive credentials as part of the command string. What is the main security risk?
ACredentials may be exposed in Terraform logs or process list
BTerraform automatically encrypts all command strings
CLocal-exec provisioner prevents any data leakage
DCredentials are stored securely in the cloud provider
Attempts:
2 left
💡 Hint
Consider where command strings might be visible during execution.
Best Practice
expert
3:00remaining
Which approach best follows Terraform best practices when using local-exec provisioner?
You need to run a local script after creating a resource. Which practice aligns best with Terraform's recommended usage of local-exec provisioner?
AUse local-exec provisioner to run all configuration and deployment scripts regardless of complexity
BUse local-exec provisioner only for simple, non-critical commands and avoid complex scripts
CAvoid local-exec provisioner and run all commands manually outside Terraform
DEmbed sensitive credentials directly in local-exec commands for convenience
Attempts:
2 left
💡 Hint
Think about maintainability and idempotency in Terraform.