我的标签有问题,这种模式在 AWS 上有效,但对于 Azure,我遇到了奇怪的错误,有人可以查看并提供帮助吗?谢谢。
$地形计划
错误:azurerm_virtual_network.vnet:发生 1 个错误:
azurerm_virtual_network.vnet:在第 5 列第 2 行:合并:参数 1 应该是类型映射,得到类型字符串:
${ 合并(地图(“名称”,var.env_name),var.global_tags,var.vnet_tags)}
主文件
resource "azurerm_resource_group" "vnet" { name = "${var.resource_group_name}" location = "${var.location}" } resource "azurerm_virtual_network" "vnet" { name = "${var.vnet_name}" location = "${var.location}" address_space = ["${var.address_space}"] resource_group_name = "${azurerm_resource_group.vnet.name}" dns_servers = "${var.dns_servers}" tags = "${ merge(map("Name", format("%s %s", var.env_name, "Vnet")), var.global_tags, var.vnet_tags)}"
变量.tf
variable "env_name" { default = "Company DTAP" } variable "global_tags" { default = "Company Ltd" } variable "vnet_tags" { default = "Production" }