Home » HashiCorp » Terraform Associate » When using parent/child modules to deploy infrastructure, how would you export a value from one module to import into another module.
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.
A. Export the value using terraform export and input the value using terraform input.
B. Configure the pertinent provider’s configuration with a list of possible IP addresses to use.
C. Configure an output value in the application module in order to use that value for the DNS module.
D. Preconfigure the IP address as a parameter in the DNS module.
Correct Answer: C
Explanation/Reference:
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 apply.
* When using remote state, root module outputs can be accessed by other configurations via a terraform_remote_state data source.
https://www.terraform.io/docs/configuration/outputs.html
Download Printable PDF. VALID exam to help you PASS.
|
|