TA-002-P · Question #244
When using parent/child modules to deploy infrastructure, how would you export a value from one module to import into another module. For example, a module dynamically deploys an application…
The correct answer is C. Configure an output value in the application module in order to use that value for the DNS. Output values are like the return values of a Terraform module, and have several uses: A child module can use outputs to expose a subset of its resource attributes to a parent module. A root module can use outputs to print certain values in the CLI output after running…
Question
When using parent/child modules to deploy infrastructure, how would you export a value from one module to import into another module. For example, a module dynamically deploys an application instance or virtual machine, and you need the IP address in another module to configure a related DNS record in order to reach the newly deployed application.
Options
- AExport the value using terraform export and input the value using terraform input.
- BConfigure the pertinent provider's configuration with a list of possible IP addresses to use.
- CConfigure an output value in the application module in order to use that value for the DNS
- DPreconfigure the IP address as a parameter in the DNS module.
How the community answered
(26 responses)- A4% (1)
- B4% (1)
- C92% (24)
Explanation
Output values are like the return values of a Terraform module, and have several uses: * A child module can use outputs to expose a subset of its resource attributes to a parent module. * A root module can use outputs to print certain values in the CLI output after running terraform * When using remote state, root module outputs can be accessed by other configurations via a terraform_remote_state data source.
Topics
Community Discussion
No community discussion yet for this question.