|
|
|
@ -70,6 +70,12 @@ resource "digitalocean_custom_image" "flatcar" {
|
|
|
|
|
regions = [var.datacenter]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
resource "digitalocean_reserved_ip" "machine" {
|
|
|
|
|
for_each = toset(var.machines)
|
|
|
|
|
# droplet_id = digitalocean_droplet.machine[each.key].id
|
|
|
|
|
region = digitalocean_droplet.machine[each.key].region
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
resource "digitalocean_droplet" "machine" {
|
|
|
|
|
for_each = toset(var.machines)
|
|
|
|
|
name = "${var.cluster_name}-${each.key}"
|
|
|
|
@ -83,6 +89,12 @@ resource "digitalocean_droplet" "machine" {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
resource "digitalocean_reserved_ip_assignment" "machine" {
|
|
|
|
|
for_each = toset(var.machines)
|
|
|
|
|
ip_address = digitalocean_reserved_ip.machine[each.key].ip_address
|
|
|
|
|
droplet_id = digitalocean_droplet.machine[each.key].id
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
data "ct_config" "machine-ignitions" {
|
|
|
|
|
for_each = toset(var.machines)
|
|
|
|
|
content = templatefile("${path.module}/cl/machine-${each.key}.yaml.tmpl", {
|
|
|
|
@ -98,3 +110,10 @@ output "ip-addresses" {
|
|
|
|
|
"${var.cluster_name}-${key}" => digitalocean_droplet.machine[key].ipv4_address
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
output "reserved-ip-addresses" {
|
|
|
|
|
value = {
|
|
|
|
|
for key in var.machines :
|
|
|
|
|
"${var.cluster_name}-${key}" => digitalocean_reserved_ip.machine[key].ip_address
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|