How do inputs and outputs work with modules?
BeginnerConceptModules
Answer
Variables defined in the child are its inputs, passed as arguments in the module block. The child exposes values through output blocks; the parent reads them as module.<name>.<output>. A module cannot see the caller's variables or resources unless they are passed in.
More on Modules
What is a Terraform module and why use one?BeginnerHow do you call a module?BeginnerWhich module source types exist and where does `version` apply?IntermediateHow should you version and pin modules?IntermediateCan you use `count` and `for_each` on modules?IntermediateHow do providers get passed to a module?Advanced