I\'m trying to setup some IaC for a new project using Hashicorp Terraform on AWS. I\'m using modules because I want to be able to reuse stuff across multiple environments (s
Outputs need to be passed up through each module explicitly each time.
For example if you wanted to output a variable to the screen from a module nested below another module you would need something like this:
output "child_foo" {
value = "foobar"
}
module "child" {
source = "path/to/child"
}
output "parent_foo" {
value = "${module.child.child_foo}"
}
module "parent" {
source = "path/to/parent"
}
output "main_foo" {
value = "${module.parent.parent_foo}"
}