Complete the code to define an output that shows the instance ID.
output "instance_id" { value = [1] }
The output value should be the instance ID, which is accessed by aws_instance.example.id.
Complete the code to add a description to the output.
output "instance_ip" { value = aws_instance.example.public_ip description = [1] }
The description must be a string enclosed in quotes to document the output.
Fix the error in the output block to correctly reference the subnet ID.
output "subnet_id" { value = aws_subnet.example[1] }
The correct attribute for the subnet ID is .id.
Fill both blanks to output the list of security group IDs and add a description.
output "security_group_ids" { value = aws_security_group.example[1] description = [2] }
To output a list of IDs, use .*.id. The description should be a quoted string.
Fill all three blanks to output a map of instance names to their private IPs with a description.
output "instance_private_ips" { value = { for inst in aws_instance.example : inst[1] => inst[2] } description = [3] }
The map key is the instance name from tags, the value is the private IP, and the description is a quoted string.