TA-002-P · Question #442
You are using a networking module in your Terraform configuration with the name label my_network. In your main configuration you have the following code: When you run terraform validate, you get the…
The correct answer is C. Define the attribute vnet_id as an output in the networking module. 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.
Question
You are using a networking module in your Terraform configuration with the name label my_network. In your main configuration you have the following code:
When you run terraform validate, you get the following error:
What must you do to successfully retrieve this value from your networking module?
Options
- ADefine the attribute vnet_id as a variable in the networking module
- BChange the referenced value to module.my_network.outputs.vnet_id
- CDefine the attribute vnet_id as an output in the networking module
- DChange the referenced value to my_network.outputs.vnet_id
How the community answered
(25 responses)- B4% (1)
- C88% (22)
- D8% (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_addr, you could access that value as module.web_server.instance_ip_addr.
Topics
Community Discussion
No community discussion yet for this question.