Open dzmitry-lahoda opened 3 years ago
Hi @dzmitry-lahoda - I think the functionality you are looking for may be better achieved by using Provider Aliases in this case? https://www.terraform.io/docs/language/providers/configuration.html#alias-multiple-provider-configurations
This will allow you to inform specific resources to use particular values for properties such as subscription_id
. The Providers in your config share the same source, so shares the same data.
So if to add alias to azurerm
but with other sub, I will not get my non aliased resources destroyed (aks)?
provider "azurerm" {
tenant_id = var.main_azure_tenant_id
subscription_id = "11111111111111111111"
features {}
}
provider "azurerm" {
tenant_id = var.main_azure_tenant_id
subscription_id = "2222222222222222222222"
alias = "foo"
features {}
}
it wee weird issue happening. works well:
data "azurerm_key_vault" "multiplay" {
for_each = var.targets
provider = azurerm-backend
..
}
provider "azurerm-backend" {
tenant_id = var.main_azure_tenant_id
subscription_id = var.consumer_azure_subscription
features {}
}
but when I add
provider "azurerm-aom" {
tenant_id = var.main_azure_tenant_id
subscription_id = var.main_azure_subscription_id
features {}
}
it is if provider = azurerm-backend
is not applied. or even they reverse order-mapping
if I use alias I get
│ Error: Insufficient features blocks
│
│ on <empty> line 0:
│ (source code not available)
│
│ At least 1 "features" blocks are required.
but all feature blocks are defined i think
UPDATE: Oh it is about that must have features {}
block. Not related. There is issue for that.
@jackofallops
The Providers in your config share the same source, so shares the same data.
Not sure why that happens. I configure subscription_id
differently. And it still uses same subscription? So sub first is 1111111111 and sub second is 2222222222 , but still one of them used and other is neglected?
Community Note
Terraform (and AzureRM Provider) Version
Affected Resource(s)
azurerm
Terraform Configuration Files
Debug Output
Expected Behaviour
Actual Behaviour
Steps to Reproduce
azurerm