Challenge - 5 Problems
Local-exec Provisioner Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ service_behavior
intermediate2: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" } }
Attempts:
2 left
💡 Hint
The local-exec provisioner runs commands on the machine where Terraform runs.
✗ Incorrect
The local-exec provisioner runs the specified command locally and prints its output to the console during resource creation.
❓ Configuration
intermediate2: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?
Attempts:
2 left
💡 Hint
Consider how to explicitly run a script with bash.
✗ Incorrect
Using 'bash setup.sh' explicitly runs the script with bash, ensuring compatibility. './setup.sh' requires executable permission and correct shebang. 'sh ./setup.sh' may work but is less explicit. 'run setup.sh' is invalid.
❓ Architecture
advanced2: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?
Attempts:
2 left
💡 Hint
Think about where local-exec commands actually run.
✗ Incorrect
Local-exec provisioner runs commands locally on the machine running Terraform, not on remote cloud resources. This can limit its use for configuring remote machines directly.
❓ security
advanced2: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?
Attempts:
2 left
💡 Hint
Consider where command strings might be visible during execution.
✗ Incorrect
Commands run by local-exec may appear in logs or system process lists, exposing sensitive data if included directly in the command string.
✅ Best Practice
expert3: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?
Attempts:
2 left
💡 Hint
Think about maintainability and idempotency in Terraform.
✗ Incorrect
Terraform recommends using local-exec provisioner sparingly for simple tasks. Complex or critical configuration is better handled by dedicated configuration management tools or remote-exec provisioner.