Hashicorp Certified Terraform Associate 003 · Free Practice Question Medium

Question 7

In the example below, where is the value of the DNS record's IP address originating from?



  • A

    the regular expression named module.web_server

  • B

    by querying the AWS EC2 API to retrieve the IP address

  • C

    the output of a module named web_server

  • D

    value of the web_server parameter from the variables.tf file

Reveal correct answer

Correct answer: C

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_addr, you could access that value as module.web_server.instance_ip_addr.

https://developer.hashicorp.com/terraform/language/expressions#references-to-named-values

A. The value of the DNS record's IP address is not originating from a regular expression named module.web_server. In Terraform, module.web_server refers to the module itself, not a specific attribute or value within the module. Therefore, it is not the source of the IP address for the DNS record.

B. The value of the DNS record's IP address is not originating from querying the AWS EC2 API to retrieve the IP address. In this scenario, the IP address is being obtained from the output of the web_server module directly, rather than querying external APIs or services to retrieve the IP address dynamically.

C. The correct choice is that the value of the DNS record's IP address is originating from the output of a module named web_server. The records attribute in the aws_route53_record resource is being populated with the IP address obtained from the output of the web_server module, allowing the DNS record to point to the correct IP address.

D. The value of the DNS record's IP address is not originating from a parameter in the variables.tf file. In this case, the IP address is being retrieved from the output of a module named web_server, not from a static parameter defined in the variables.tf file.

Discussion

Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.

You must be logged in to post a comment.

Preparing For

Your Certification?

255+ certifications
Detailed explanations
Free PDF samples

Has All The Questions You Need