我使用 terraform 已经有一段时间了,但我对代码毫无经验。我一直在使用下面的块来为我的主机生成描述。
resource "vra_deployment" "test_instance" {
count = var.instance_count
catalog_item_name = var.catalog_item_name
description = "${var.hostname_prefix}${format("%02d", count.index+2)}-${replace(lower(var.region), "-","")}"
这会给我一个主机,其描述类似于 host02-region。目前我只使用这个计数变量设置为1。
我想这样做,如果我将 count 变量设置为 2,它将构建 2 台主机,其描述仅为偶数,即 host02-region 和 host04-region。
谁能告诉我如何做到这一点?