diff --git a/infra/postgres.tf b/infra/postgres.tf index ac7bb35..5284362 100644 --- a/infra/postgres.tf +++ b/infra/postgres.tf @@ -1,18 +1,57 @@ -module "k3s_masters" { - # Use 'git::' prefix and append the branch/tag/commit with '?ref=' - source = "git::https://gitlab.durp.info/durfy/modules/terraform/proxmox-vm.git?ref=main" - - # Inputs - count = local.postgres.count - vm_names = local.postgres.name - target_nodes = local.postgres.node - vm_ips = local.postgres.ip - vlan = local.vlan - template = local.template - storage = local.postgres.storage - cores = local.postgres.cores - memory = local.postgres.memory - sshkeys = local.sshkeys - dnsserver = local.dnsserver - drive_size = local.postgres.drive +resource "proxmox_vm_qemu" "postgres" { + count = local.postgres.count + ciuser = "administrator" + vmid = "${local.vlan}${local.postgres.ip[count.index]}" + name = local.postgres.name[count.index] + target_node = local.postgres.node[count.index] + clone = local.template + tags = local.postgres.tags + qemu_os = "l26" + full_clone = true + os_type = "cloud-init" + agent = 1 + cores = local.postgres.cores + sockets = 1 + cpu_type = "host" + memory = local.postgres.memory + scsihw = "virtio-scsi-pci" + #bootdisk = "scsi0" + boot = "order=virtio0" + onboot = true + sshkeys = local.sshkeys + vga { + type = "serial0" + } + serial { + id = 0 + type = "socket" + } + disks { + ide { + ide2 { + cloudinit { + storage = local.postgres.storage + } + } + } + virtio { + virtio0 { + disk { + size = local.postgres.drive + format = local.format + storage = local.postgres.storage + } + } + } + } + network { + id = 0 + model = "virtio" + bridge = "vmbr0" + tag = local.vlan + } + #Cloud Init Settings + ipconfig0 = "ip=192.168.${local.vlan}.${local.postgres.ip[count.index]}/24,gw=192.168.${local.vlan}.1" + searchdomain = "durp.loc" + nameserver = local.dnsserver }