output in Terraform is a way to view the result of an action that has been performed, or resource that has been created.
Let’s say that you have some code to create a Load Balancer, or Assign a Public IP. Once this action is complete, the
output block will have access to this created value.
This will output the values to the console once the
terraform apply step has successfully run.
But what happens if you have some outputs in a module that your own Terraform calls?
Outputs are only rendered to the immediate caller, and not traversed up the call tree to the initiation
An example project structure
main.tf we call:
This will not render any
output to the console, as the
output.tf is segmented to the module itself and not passed up the chain.
To get access to these outputs after module creation, we need to do the following:
How to pass a Module’s Output up the tree to the Parent