0
0
Terraformcloud~10 mins

Output values after apply 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 define an output that shows the instance ID.

Terraform
output "instance_id" {
  value = [1]
}
Drag options to blanks, or click blank then click option'
Aaws_instance.example.name
Baws_instance.example.id
Caws_instance.example.type
Daws_instance.example.region
Attempts:
3 left
💡 Hint
Common Mistakes
Using .name or .type instead of .id
Forgetting to reference the resource name
2fill in blank
medium

Complete the output block to display the public IP of the instance.

Terraform
output "public_ip" {
  value = [1]
}
Drag options to blanks, or click blank then click option'
Aaws_instance.web.public_dns
Baws_instance.web.private_ip
Caws_instance.web.public_ip
Daws_instance.web.id
Attempts:
3 left
💡 Hint
Common Mistakes
Using .private_ip instead of .public_ip
Using .id or .public_dns instead
3fill in blank
hard

Fix the error in the output block to correctly show the subnet ID.

Terraform
output "subnet_id" {
  value = [1]
}
Drag options to blanks, or click blank then click option'
Aaws_subnet.main.id
Baws_subnet.main.name
Caws_subnet.main.subnet_id
Daws_subnet.main.cidr_block
Attempts:
3 left
💡 Hint
Common Mistakes
Using .subnet_id which does not exist
Using .name or .cidr_block instead of .id
4fill in blank
hard

Fill both blanks to output the instance's private IP and availability zone.

Terraform
output "instance_info" {
  value = {
    private_ip = [1]
    az         = [2]
  }
}
Drag options to blanks, or click blank then click option'
Aaws_instance.app.private_ip
Baws_instance.app.public_ip
Caws_instance.app.availability_zone
Daws_instance.app.id
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing public_ip with private_ip
Using .id instead of availability_zone
5fill in blank
hard

Fill all three blanks to output the bucket name, region, and ARN.

Terraform
output "bucket_details" {
  value = {
    name   = [1]
    region = [2]
    arn    = [3]
  }
}
Drag options to blanks, or click blank then click option'
Aaws_s3_bucket.mybucket.bucket
Baws_s3_bucket.mybucket.region
Caws_s3_bucket.mybucket.arn
Daws_s3_bucket.mybucket.id
Attempts:
3 left
💡 Hint
Common Mistakes
Using .id instead of .bucket for the name
Confusing region with ARN