我正在尝试循环DigitalOcean Droplet中的所有实例,该Droplet有未知数量的实例要添加到DigitalOcean项目中。
像下面这样的东西,但不知道如何
resource "digitalocean_droplet" "web" {
count = var.droplet_count
name = "web-${var.name}-${var.region}-${count.index +1}"
size = "512mb"
image = "centos-7-x64"
region = "nyc3"
}
resource "digitalocean_project_resources" "barfoo" {
project = data.digitalocean_project.foo.id
resources = [
digitalocean_droplet.web.*.urn, # this part having issues with
digitalocean_droplet.bastion.urn,
]
}
resources-与项目关联的资源的统一资源名称(URNs(列表
尝试
resources = flatten([digitalocean_droplet.web.*.urn, digitalocean_droplet.bastion.urn])