将所有 DigitalOcean Droplet 实例添加到 Terraform 中的项目
Add all DigitalOcean Droplet Instances to a Project in Terraform
我正在尝试循环 DigitalOcean 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,
]
}
资源 - 与项目关联的资源的统一资源名称 (URN) 列表
尝试
resources = flatten([digitalocean_droplet.web.*.urn, digitalocean_droplet.bastion.urn])
我正在尝试循环 DigitalOcean 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,
]
}
资源 - 与项目关联的资源的统一资源名称 (URN) 列表
尝试
resources = flatten([digitalocean_droplet.web.*.urn, digitalocean_droplet.bastion.urn])