0
0
Terraformcloud~10 mins

Sensitive output values in Terraform - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to mark the output value as sensitive.

Terraform
output "db_password" {
  value     = aws_db_instance.example.password
  sensitive = [1]
}
Drag options to blanks, or click blank then click option'
Afalse
Btrue
C"true"
Dyes
Attempts:
3 left
💡 Hint
Common Mistakes
Using string "true" instead of boolean true
Setting sensitive to false or yes
2fill in blank
medium

Complete the code to output the database endpoint without exposing it as sensitive.

Terraform
output "db_endpoint" {
  value     = aws_db_instance.example.endpoint
  sensitive = [1]
}
Drag options to blanks, or click blank then click option'
Afalse
Btrue
C"false"
Dno
Attempts:
3 left
💡 Hint
Common Mistakes
Using string "false" instead of boolean false
Setting sensitive to true hides the output
3fill in blank
hard

Fix the error in the output block to correctly mark the secret key as sensitive.

Terraform
output "secret_key" {
  value     = aws_secretsmanager_secret.example.secret_string
  sensitive = [1]
}
Drag options to blanks, or click blank then click option'
A"true"
B1
Ctrue
Dyes
Attempts:
3 left
💡 Hint
Common Mistakes
Using string "true" instead of boolean true
Using yes or 1 which are invalid
4fill in blank
hard

Fill both blanks to output the admin password as sensitive and add a description.

Terraform
output "admin_password" {
  value       = aws_iam_user.admin.password
  sensitive   = [1]
  description = [2]
}
Drag options to blanks, or click blank then click option'
Atrue
Bfalse
C"The admin user password"
D"Admin password output"
Attempts:
3 left
💡 Hint
Common Mistakes
Setting sensitive to false exposes the password
Not quoting the description string
5fill in blank
hard

Fill all three blanks to output the API key as sensitive, with a description and a custom export name.

Terraform
output "api_key" {
  value       = aws_api_gateway_api_key.example.value
  sensitive   = [1]
  description = [2]
  export_name = [3]
}
Drag options to blanks, or click blank then click option'
Atrue
B"API key for external use"
C"external_api_key"
Dfalse
Attempts:
3 left
💡 Hint
Common Mistakes
Using false for sensitive exposes the key
Not quoting description or export_name