Challenge - 5 Problems
Terraform Output Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Configuration
intermediate2:00remaining
Identify the correct output declaration syntax
Which Terraform output declaration will correctly output the value of the variable
instance_id?Attempts:
2 left
💡 Hint
Terraform output blocks require a name in quotes and a value attribute inside curly braces.
✗ Incorrect
Terraform output declarations must use the syntax: output "name" { value = expression }. Options B, C, and D do not follow this syntax and will cause errors.
❓ service_behavior
intermediate2:00remaining
What is the output value type?
Given the following Terraform output declaration, what is the type of the output value?
Terraform
output "server_ips" { value = ["10.0.0.1", "10.0.0.2"] }
Attempts:
2 left
💡 Hint
Look at the square brackets and the values inside.
✗ Incorrect
The value is a list (array) containing two string elements, so the output type is a list of strings.
❓ Architecture
advanced2:00remaining
Which output declaration correctly exports a nested attribute?
You have a resource
aws_instance.web with an attribute public_ip. Which output declaration correctly exports this attribute?Attempts:
2 left
💡 Hint
Use dot notation to access resource attributes.
✗ Incorrect
The correct syntax to access the public_ip attribute of the aws_instance resource named web is aws_instance.web.public_ip. Options A and C use invalid indexing syntax, and D uses a wrong attribute name.
❓ security
advanced2:00remaining
Which output declaration exposes sensitive data correctly?
You want to output a database password stored in
var.db_password but keep it hidden in Terraform output. Which declaration is correct?Attempts:
2 left
💡 Hint
Terraform supports a sensitive flag in output blocks.
✗ Incorrect
To mark an output as sensitive and hide its value in CLI output, use the sensitive = true attribute. Options A and B do not hide the value, and D uses an invalid attribute.
✅ Best Practice
expert2:00remaining
What is the effect of missing the output block's value attribute?
Consider this Terraform output declaration:
output "region" {}
What happens when you run terraform apply?Attempts:
2 left
💡 Hint
Output blocks require a value attribute to be valid.
✗ Incorrect
Terraform requires the value attribute in output blocks. Omitting it causes a validation error during plan or apply.