Providers within Modules, Provider Aliases, and Proxy Configs

Hi @nnellans-acts,

Specifying the providers meta-argument in a module block overrides all of the automatic inheritance behaviors, because shared modules that need multiple configurations often don’t agree with their caller about which one is the “default” (if any), what aliases the additional configurations have, etc.

However, if your two modules do happen to agree about the configurations then you can pass them through with an identity mapping like this:

  providers = {
    azurerm = azurerm
    azurerm.other = azurerm.other
  }

The child module will, in current versions of Terraform, need to also declare that it expects to receive an additional configuration with alias “other”, using a proxy configuration block like this:

provider "azurerm" {
  alias = "other"
}