我想创建多个azure_rm提供程序,从一个变量列表。尝试使用"count“是不可能的,我得到消息”保留供将来使用“。
从技术上讲,我想要动态创建的部分是:
provider "azurerm" {
features {}
subscription_id = "1d1a56ed-681f-xxxx-xxxx-xxxxxxxxxxxx"
alias = "spoke1"
}我也尝试过使用for_each,但也不可能,因为for_each只创建了一个部分,而不是一个完整的“提供者”部分。
# To improve... try to use dynamic block
# It looks to be not possible. Could be necessary to auto-generate this scetion with external script
# provider "azurerm" {
# features {}
# dynamic "spoke" {
# for_each = var.spoke_networks
# content {
# subscription_id = spoke.value["subscription_id"]
# alias = spoke.value["subscription_alias"]
# }
# }
# }我想要实现的只是为我的变量(Spoke_networks)提供一个新的条目,而terraform创建一个新的提供者。变量文件结构应该是这样的:
variable "spoke_networks" {
description = "List with the properties of the Spoke VNETs"
type = list(object({subscription_alias=string ,subscription_id=string , resource_group_name=string , vnet_name=string }))
}谢谢你,VS
发布于 2021-11-03 22:21:03
你不能用terraform做到这一点。但也许你可以用terragrunt做到这一点。
https://stackoverflow.com/questions/69829508
复制相似问题