1. HashiCorp Terraform Documentation, "Input Variables": This source clarifies that input variables serve as parameters for a module, allowing a parent module to pass data into the child module. It does not describe a mechanism for accessing them from the outside. The documentation states, "Input variables serve as parameters for a Terraform module, allowing aspects of the module to be customized without altering the module's own source code, and allowing modules to be shared between different configurations." This defines their role as an input mechanism only.
Source: HashiCorp, "Terraform / Language / Modules / Input Variables".
2. HashiCorp Terraform Documentation, "Output Values": This is the most direct source refuting the statement. It explicitly defines output values as the sole method for exporting data from a module. The documentation states, "Output values are like the return values of a module... They are a way to expose some information about the resources a module creates to the module that called it." This confirms that a specific construct (output) is required to make data accessible outside the module.
Source: HashiCorp, "Terraform / Language / Modules / Output Values".
3. HashiCorp Terraform Documentation, "Module Composition": This section describes the benefits of modules, including encapsulation. It explains that modules are self-contained and interact with parent modules through a defined interface of input variables and output values. "A good module has a clean separation between its implementation details and its inputs and outputs. This makes the module easier to understand and to change over time." This principle of a "clean separation" is violated if internal variables are directly accessible.
Source: HashiCorp, "Terraform / Language / Modules / Module Composition".