How do providers get passed to a module?
AdvancedConceptModules
Answer
Implicitly, the module inherits the default provider configurations. For aliases, use the providers map.
module "dr" {
source = "./modules/app"
providers = { aws = aws.dr }
}
Inside a reusable module declare configuration_aliases in required_providers if it needs more than one, and never put provider blocks with credentials in child modules.
More on Modules
What is a Terraform module and why use one?BeginnerHow do you call a module?BeginnerHow do inputs and outputs work with modules?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?Intermediate