Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

When trying to run the following script I get an error and I don’t understand why. All the example show it should be done this way:
resource "digitalocean_loadbalancer" "web" {
name = "loadbalancer-1"
region = "ams3"
forwarding_rule {
entry_port = 80
entry_protocol = "http"
target_port = 80
target_protocol = "http"
}
healthcheck {
port = 80
protocol = "tcp"
}
droplet_ids = ["${digitalocean_droplet.web.*.id}"]
}
resource "digitalocean_droplet" "web" {
count = 2
image = "ubuntu-18-04-x64"
name = "web-${count.index + 1}"
region = "ams3"
size = "s-1vcpu-1gb"
private_networking = true
user_data = "${file("config/webuserdata.sh")}"
ssh_keys = [
"${var.ssh_fingerprint}"
]
}
The error:
Error: Incorrect attribute value type
on web.tf line 18, in resource "digitalocean_loadbalancer" "web":
18: droplet_ids = ["${digitalocean_droplet.web.*.id}"]
Inappropriate value for attribute "droplet_ids": element 0: number required.
I’m new to terraform and I don’t know how to solve this issue.
72e571841e7f4a6881090a2f3e93c0
dom77a6e2e9d3a2
Christoffer Braathen
Jaimin Joshi
099d155dd62c45078c85bd5b98d003
82488cefb7d74db1ad87250ea4f452
Mrugesh Mohapatra
828c1c19bec3419eb032d05c128960
Rumyana Rumenova
Ben Roberts
garry55441234