我想从terraform上的资源更新一个变量。
这可行吗?我对这项技术还不太熟悉。
variable "contador" {
default = 0
}
resource "azurerm_managed_disk" "test-disks-test3" {
count = "${length(var.disks_size) * var.vm_number}"
name = "SRV${var.service_base_name}${var.service_environment}01-DATADISK-0${count.index}"
location = "westeurope"
resource_group_name = "${azurerm_resource_group.test-rg-test3.name}"
storage_account_type = "${var.disk_tier}_${var.disk_replication}"
create_option = "Empty"
disk_size_gb = "${element(var.disks_size, count.index)}"
var.contador = "${count.index % length(var.disks_size) == (length(var.disks_size) - 1) ? (var.contador + 1) : var.contador}"
tags{
environment = "TestWork"
}
}
需要翻译的内容是:
问题所在的行是:
var.contador = "${count.index % length(var.disks_size) == (length(var.disks_size) - 1) ? (var.contador + 1) : var.contador}"