Challenge - 5 Problems
Terraform Output Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ service_behavior
intermediate2:00remaining
Understanding Terraform output command behavior
You run
terraform output after applying your configuration. What will this command display?Terraform
output "instance_ip" { value = aws_instance.web.public_ip } # After terraform apply completes successfully, you run: terraform output
Attempts:
2 left
💡 Hint
Think about what the output block defines and what the terraform output command does.
✗ Incorrect
The terraform output command displays the values of output variables defined in the configuration after a successful apply. It does not show the entire state or delete anything.
❓ Configuration
intermediate2:00remaining
Correct usage of terraform output command with specific output name
You want to see only the value of the output named
db_password. Which command will correctly show just this value?Attempts:
2 left
💡 Hint
Check the terraform output command syntax for specifying output names.
✗ Incorrect
The correct syntax to show a specific output value is 'terraform output '. Other options are invalid or do not exist.
❓ Architecture
advanced2:00remaining
How terraform output command interacts with remote state
If your Terraform state is stored remotely (e.g., in an S3 backend), what does
terraform output do when you run it locally?Attempts:
2 left
💡 Hint
Think about how Terraform manages state when using remote backends.
✗ Incorrect
Terraform automatically fetches the latest remote state when running commands like 'terraform output' to show accurate output values.
❓ security
advanced2:00remaining
Security considerations when using terraform output command
Which of the following is a security risk when using
terraform output to display sensitive values?Attempts:
2 left
💡 Hint
Consider what happens when secrets are printed on screen or saved in logs.
✗ Incorrect
Sensitive outputs printed by terraform output can be seen by anyone with access to the terminal or logs, so care must be taken to avoid exposure.
✅ Best Practice
expert2:00remaining
Best practice for using terraform output in automation scripts
You want to use the output value of
api_endpoint in a shell script after terraform apply. Which command usage is best to get the raw value without extra formatting?Attempts:
2 left
💡 Hint
Check terraform output flags for raw output suitable for scripts.
✗ Incorrect
The '-raw' flag outputs the value without quotes or extra formatting, ideal for scripts. Other options either include formatting or are invalid.