HashiCorp
TA-002-P · Question #267
In the example below, where is the value of the DNS record's IP address originating from? 1. resource "aws_route53_record" "www" 2. { 3. zone_id = aws_route53_zone.primary.zone_id 5. type = "A" 6…
The correct answer is B. The output of a module named web_server. In a parent module, outputs of child modules are available in expressions as module.<MODULE NAME>.<OUTPUT NAME>. For example, if a child module named web_server declared an output named instance_ip_address, you could access that value as module.web_server.instance_ip_address.
Interact with Terraform modules
Question
In the example below, where is the value of the DNS record's IP address originating from? 1. resource "aws_route53_record" "www" 2. { 3. zone_id = aws_route53_zone.primary.zone_id 5. type = "A" 6. ttl = "300" 7. records = [module.web_server.instance_ip_address] 8. }
Options
- AThe regular expression named module.web_server
- BThe output of a module named web_server
- CBy querying the AWS EC2 API to retrieve the IP address
- DValue of the web_server parameter from the variables.tf file
How the community answered
(31 responses)- B90% (28)
- C3% (1)
- D6% (2)
Explanation
In a parent module, outputs of child modules are available in expressions as module.<MODULE NAME>.<OUTPUT NAME>. For example, if a child module named web_server declared an output named instance_ip_address, you could access that value as module.web_server.instance_ip_address.
Topics
#Terraform modules#Module outputs#Resource configuration#Data referencing
Community Discussion
No community discussion yet for this question.