Reputation: 1
I'm having hard time working with modules of multiple versions, i even tried using Alias but its not working. Here's an sample code. Can someone suggest where i'm doing wrong? or what's the correct way.
providers = {
azurerm = azurerm
azurerm.permission = azurerm.permission
}
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 2.76.0"
}
azurerm = {
source = "hashicorp/azurerm"
version = "~> 3.7.0"
configuration_aliases = [azurerm.permission]
}
provider "azurerm" {
features {}
subscription_id = data.vault_generic_secret.vault-spoke-spn.data["subscription_id"]
tenant_id = data.vault_generic_secret.vault-spoke-spn.data["tenant_id"]
client_id = data.vault_generic_secret.vault-spoke-spn.data["client_id"]
client_secret = data.vault_generic_secret.vault-spoke-spn.data["client_secret"]
}
provider "azurerm" {
features {}
alias = "permission"
subscription_id = data.vault_generic_secret.vault-spoke-spn.data["subscription_id"]
tenant_id = data.vault_generic_secret.vault-spoke-spn.data["tenant_id"]
client_id = data.vault_generic_secret.vault-spoke-spn.data["client_id"]
client_secret = data.vault_generic_secret.vault-spoke-spn.data["client_secret"]
}
Upvotes: 0
Views: 2648
Reputation: 4602
Thank You Martin Atkins for your suggestion. Adding few more points and referennce that might help other community member.
There is no way to use multiple versions of the same provider in the same configuration. You will need to either make all of your modules have some provider version they are all mutually compatible with, or to split your configuration into multiple parts so that each part can depend on a different version of the provider and be applied separately.
Inheritance and the providers argument in a module block are the two methods that providers can be explicitly passed down to successor modules. you can follow this link go into greater depth about these two choices.
Upvotes: 1