diff --git a/terraform/cloud-init.tf b/terraform/cloud-init.tf index 837a2fb..de61961 100644 --- a/terraform/cloud-init.tf +++ b/terraform/cloud-init.tf @@ -25,27 +25,34 @@ resource "proxmox_cloud_init_disk" "ci" { : ""} EOT -# Network configuration - static IP or DHCP -network_config = yamlencode({ - version = 1 - config = [{ - type = "physical" - name = "ens18" - subnets = each.value.ip != null ? [{ - type = "static" - address = each.value.ip - gateway = each.value.gateway - dns_nameservers = split(" ", each.value.nameservers) - dns_search = [each.value.search_domain] - }] : [{ - type = "dhcp" + # Network configuration - static IP or DHCP + network_config = each.value.ip != null ? yamlencode({ + version = 1 + config = [{ + type = "physical" + name = "ens18" + subnets = [{ + type = "static" + address = each.value.ip + gateway = each.value.gateway + dns_nameservers = split(" ", each.value.nameservers) + dns_search = [each.value.search_domain] + }] }] - }] -}) + }) : yamlencode({ + version = 1 + config = [{ + type = "physical" + name = "ens18" + subnets = [{ + type = "dhcp" + }] + }] + }) -# Instance metadata -meta_data = yamlencode({ - instance_id = sha1(each.key) - local-hostname = each.key -}) + # Instance metadata + meta_data = yamlencode({ + instance_id = sha1(each.key) + local-hostname = each.key + }) }