Skill 5.2.1
Passing values into modules
Key Concepts
Each input variable declared in the child module becomes an argument of the module block. module "web" { source = "./modules/web" instance_type = var.instance_type } sets the child's instance_type variable from the parent's variable of the same name; the names need not match. Variables without defaults in the child are required arguments of the module block.
A child cannot read var. values, locals or resources of its parent, and the parent cannot read the child's variables or locals. To pass a value through several levels, every intermediate module must declare a variable and pass it on. Only root module variables can be set from the command line, environment variables or variable files.