You are retrieving the value vnet_id from a networking module named my_network. Which step must you perform?

Prepare for the HashiCorp Terraform Associate Exam with quizzes, flashcards, and multiple-choice questions. Each question includes hints and explanations. Boost your confidence and ace your exam!

Multiple Choice

You are retrieving the value vnet_id from a networking module named my_network. Which step must you perform?

Explanation:
To retrieve a value from a module, that value must be exposed as an output by the module. Variables inside the module are for input values, not for exporting data to the caller. By defining vnet_id as an output in the networking module, Terraform can surface that value to the configuration that calls the module. Then you can access it with module.my_network.vnet_id in the root configuration. The other options either treat the value as an input or use an incorrect reference syntax (module.my_network.outputs.vnet_id or my_network.outputs.vnet_id), which isn’t how Terraform exports module data.

To retrieve a value from a module, that value must be exposed as an output by the module. Variables inside the module are for input values, not for exporting data to the caller. By defining vnet_id as an output in the networking module, Terraform can surface that value to the configuration that calls the module. Then you can access it with module.my_network.vnet_id in the root configuration. The other options either treat the value as an input or use an incorrect reference syntax (module.my_network.outputs.vnet_id or my_network.outputs.vnet_id), which isn’t how Terraform exports module data.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy