0
0
Terraformcloud~10 mins

Module outputs 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 output the module's instance ID.

Terraform
output "instance_id" {
  value = module.web_server.[1]
}
Drag options to blanks, or click blank then click option'
Aid
Binstance_id
Cinstance
Dserver_id
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect attribute names like 'instance' or 'server_id'.
Confusing module name with output name.
2fill in blank
medium

Complete the code to define an output that shows the module's public IP.

Terraform
output "public_ip" {
  value = module.network.[1]
}
Drag options to blanks, or click blank then click option'
Aip_address
Bpublic_ip
Cip
Daddress
Attempts:
3 left
💡 Hint
Common Mistakes
Using generic names like 'ip' or 'address' that may not exist.
Assuming the output name without checking the module.
3fill in blank
hard

Fix the error in the output block to correctly reference the module's subnet ID.

Terraform
output "subnet_id" {
  value = module.vpc.[1]
}
Drag options to blanks, or click blank then click option'
Asubnet
BsubnetId
CsubnetID
Dsubnet_id
Attempts:
3 left
💡 Hint
Common Mistakes
Using camelCase or PascalCase instead of snake_case.
Guessing output names without verifying.
4fill in blank
hard

Fill both blanks to output the module's database endpoint and port.

Terraform
output "db_connection" {
  value = "${module.database.[1]:${module.database.[2]"
}
Drag options to blanks, or click blank then click option'
Aendpoint
Bport
Chost
Daddress
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up host and port names.
Using incorrect output names like 'address' or 'host' if not defined.
5fill in blank
hard

Fill all three blanks to output a formatted string with module's name, instance ID, and availability zone.

Terraform
output "instance_info" {
  value = "Name: ${module.app.[1], ID: ${module.app.[2], AZ: ${module.app.[3]"
}
Drag options to blanks, or click blank then click option'
Aname
Binstance_id
Cavailability_zone
Did
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing instance_id with id.
Using incorrect output names or wrong casing.