TERRAFORM-ASSOCIATE-004 · Question #60
TERRAFORM-ASSOCIATE-004 Question #60: Real Exam Question with Answer & Explanation
The correct answer is C: Define the attribute vnet_id as an output in the networking module. To expose a value from a child module to its caller, the value must be explicitly declared as an output in that module. The correct reference syntax is module.<module_name>.<output_name> (e.g., module.my-network.vnet_id). Simply declaring a variable inside the module is not suffi
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
- AChange the reference value to my-network,outputs,vmet_id
- BDefine the attribute vmet_id as a variable in the networking modeule
- CDefine the attribute vnet_id as an output in the networking module
- DChange the reference value module.my,network,outputs,vnet_id
Explanation
To expose a value from a child module to its caller, the value must be explicitly declared as an output in that module. The correct reference syntax is module.<module_name>.<output_name> (e.g., module.my-network.vnet_id). Simply declaring a variable inside the module is not sufficient - outputs act as the module's public interface. Without an output declaration, Terraform cannot resolve the reference and will throw a validation error.
Topics
Community Discussion
No community discussion yet for this question.