Working with centralized config

This commit is contained in:
2025-08-11 13:26:21 -07:00
parent 04e93148e7
commit 19b02e6f5a
13 changed files with 39 additions and 17 deletions

19
main.tf
View File

@@ -78,7 +78,8 @@ resource "digitalocean_droplet" "machine" {
region = var.datacenter
size = var.server_type
ssh_keys = [digitalocean_ssh_key.first.fingerprint]
user_data = data.ct_config.machine-ignitions[each.key].rendered
# user_data = data.ct_config.machine-ignitions[each.key].rendered
user_data = file("flatcar/ignition.json")
lifecycle {
create_before_destroy = true
}
@@ -90,14 +91,14 @@ resource "digitalocean_reserved_ip_assignment" "machine" {
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", {
ssh_keys = jsonencode(var.ssh_keys),
name = each.key
})
strict = true
}
# data "ct_config" "machine-ignitions" {
# for_each = toset(var.machines)
# content = templatefile("${path.module}/cl/machine-${each.key}.yaml.tmpl", {
# ssh_keys = jsonencode(var.ssh_keys),
# name = each.key
# })
# strict = true
# }
output "ip-addresses" {
value = {