diff --git a/.gitignore b/.gitignore index 723ef36..d32217b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -.idea \ No newline at end of file +*/.terraform +*/.terraform.lock.hcl +.idea diff --git a/dmz/main.tf b/dmz/main.tf new file mode 100644 index 0000000..eb23c67 --- /dev/null +++ b/dmz/main.tf @@ -0,0 +1,68 @@ +terraform { + backend "http" {} + required_providers { + proxmox = { + source = "Telmate/proxmox" + version = "3.0.1-rc9" + } + } +} + +provider "proxmox" { + pm_parallel = 1 + pm_tls_insecure = true + pm_api_url = var.pm_api_url + pm_user = var.pm_user + pm_password = var.pm_password + pm_debug = false +} + +locals { + sshkeys = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDEphzWgwUZnvL6E5luKLt3WO0HK7Kh63arSMoNl5gmjzXyhG1DDW0OKfoIl0T+JZw/ZjQ7iii6tmSLFRk6nuYCldqe5GVcFxvTzX4/xGEioAyG0IiUGKy6s+9xzO8QXF0EtSNPH0nfHNKcCjgwWAzM+Lt6gW0Vqs+aU5ICuDiEchmvYPz+rBaVldJVTG7m3ogKJ2aIF7HU/pCPp5l0E9gMOw7s0ABijuc3KXLEWCYgL39jIST6pFH9ceRLmu8Xy5zXHAkkEEauY/e6ld0hlzLadiUD7zYJMdDcm0oRvenYcUlaUl9gS0569IpfsJsjCejuqOxCKzTHPJDOT0f9TbIqPXkGq3s9oEJGpQW+Z8g41BqRpjBCdBk+yv39bzKxlwlumDwqgx1WP8xxKavAWYNqNRG7sBhoWwtxYEOhKXoLNjBaeDRnO5OY5AQJvONWpuByyz0R/gTh4bOFVD+Y8WWlKbT4zfhnN70XvapRsbZiaGhJBPwByAMGg6XxSbC6xtbyligVGCEjCXbTLkeKq1w0DuItY+FBGO3J2k90OiciTVSeyiVz9J/Y03UB0gHdsMCoVNrj+9QWfrTLDhM7D5YrXUt5nj2LQTcbtf49zoQXWxUhozlg42E/FJU/Yla7y55qWizAEVyP2/Ks/PHrF679k59HNd2IJ/aicA9QnmWtLQ== ansible" + template = "Debian12-Template" + storage = "cache-domains" + emulatessd = true + format = "raw" + dnsserver = "192.168.98.1" + vlan = 98 + k3smaster = { + tags = "k3s_dmz" + count = 3 + name = ["master01-dmz", "master02-dmz", "master03-dmz"] + cores = 2 + memory = "4096" + drive = 20 + node = ["mothership", "overlord", "vanguard"] + ip = ["11", "12", "13"] + } + k3sserver = { + tags = "k3s_dmz" + count = 3 + name = ["node01-dmz", "node02-dmz", "node03-dmz"] + cores = 4 + memory = "8192" + drive = 240 + node = ["mothership", "overlord", "vanguard"] + ip = ["21", "22", "23"] + } + openVPN = { + tags = "openVPN" + count = 1 + name = ["openVPN"] + cores = 2 + memory = "4096" + drive = 20 + node = ["mothership"] + ip = ["20"] + } + matrix = { + tags = "matrix" + count = 1 + name = ["matrix"] + cores = 2 + memory = "4096" + drive = 60 + node = ["vanguard"] + ip = ["21"] + } +} diff --git a/dmz/matrix.tf b/dmz/matrix.tf new file mode 100644 index 0000000..66dd4c7 --- /dev/null +++ b/dmz/matrix.tf @@ -0,0 +1,57 @@ +resource "proxmox_vm_qemu" "matrix" { + count = local.matrix.count + ciuser = "administrator" + vmid = "${local.vlan}${local.matrix.ip[count.index]}" + name = local.matrix.name[count.index] + target_node = local.matrix.node[count.index] + clone = local.template + tags = local.matrix.tags + qemu_os = "l26" + full_clone = true + os_type = "cloud-init" + agent = 1 + cores = local.matrix.cores + sockets = 1 + cpu_type = "host" + memory = local.matrix.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.storage + } + } + } + virtio { + virtio0 { + disk { + size = local.matrix.drive + format = local.format + storage = local.storage + } + } + } + } + network { + id = 0 + model = "virtio" + bridge = "vmbr0" + tag = local.vlan + } + #Cloud Init Settings + ipconfig0 = "ip=192.168.${local.vlan}.${local.matrix.ip[count.index]}/24,gw=192.168.${local.vlan}.1" + searchdomain = "durp.loc" + nameserver = local.dnsserver +}