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 using terraform to create a swarm on DigitalOcean, how can I pass the join-token to a worker node? I can create a simple 2-node swarm; a manager node and a worker node; but there does not seem to be an efficient way to pass the join-token to the worker node:
*Code snippet manager node*
provisioner "remote-exec" {
inline = [
"sudo ufw allow 2377,7946/tcp",
"sudo ufw allow 4789,7946/udp",
"sudo docker swarm init --advertise-addr ${digitalocean_droplet.manager1.ipv4_address_private}"
]
}
*Code snippet worker node*
provisioner "remote-exec" {
inline = [
"sudo ufw allow 2377,7946/tcp",
"sudo ufw allow 4789,7946/udp",
"docker swarm join --token ${var.worker_token} ${digitalocean_droplet.manager1.ipv4_address_private}:2377"
]
}
If I issue this command: docker swarm join-token -q worker I can display the token, but cannot save it to the variable ${var.worker_token} Example: “docker swarm join-token worker -q > ${var.worker_token}”
Does anyone have some insight on how to assign the output of a command to a variable and reference it later in the terraform plan?
Thank you
lwmeozrcbh
d1dd3d9538cc4d06b53e6d1d338d3f
50ff4e4b3c6c4999a12403b1ecda95
a6309a057c3f4cb38fb2e7feb67236
72e571841e7f4a6881090a2f3e93c0
7ce6bf277bff4d429ba493dd750e35
57a72a98162f46a5a5cd04d9b
Thomas Brocken
11575c6d695643cdb40ad47d0f1aea
tez.saad