Variable Scope within Modules and Child Modules
Explore how to manage variable scope in Terraform modules and child modules. Understand how to configure inputs and outputs for clear data flow, and learn best practices for sharing information explicitly between modules to keep configurations reusable and organized.
Configuring inputs and outputs for modules
We can configure inputs and outputs for modules with an API interface. This allows us to customize them for specific requirements while our code remains as DRY and reusable as possible.
Every directory containing configuration is automatically a module in Terraform. Using modules just means explicitly referencing that configuration. References to modules are created with the module block, and resources created by the child module are exposed through outputs defined in the child module.
Scope of a local value
A local ...