diff --git a/k3s-master.tf b/k3s-master.tf new file mode 100644 index 0000000..e061147 --- /dev/null +++ b/k3s-master.tf @@ -0,0 +1,64 @@ +resource "proxmox_virtual_environment_vm" "K3s-Master" { + + # VM General Settings + node_name = "prox" + vm_id = 300 + name = "K3s-Master" + description = "Kubernetes master" + tags = ["tofu", "ubuntu-22", "auto-homelab-repo", "infrastructure"] + + agent { + enabled = false # read 'Qemu guest agent' section, change to true only when ready + } + + clone { + vm_id = 8000 + } + + # VM CPU Settings + cpu { + cores = 4 + type = "host" + } + + # VM Memory Settings + memory { + dedicated = 4096 + } + + # VM Network Settings + network_device { + bridge = "vmbr0" + vlan_id = 1 + } + + # VM Disk Settings + disk { + datastore_id = "Fast2Tb" + size = 100 + interface = "scsi0" + } + + vga { + type = "serial0" + } + + initialization { + ip_config { + ipv4 { + address = "dhcp" + } + } + + user_account {} + } + + lifecycle { + ignore_changes = [ + initialization[0].user_account[0].keys, + initialization[0].user_account[0].password, + initialization[0].user_account[0].username, + ] + } + +} diff --git a/k3s-worker1.tf b/k3s-worker1.tf new file mode 100644 index 0000000..44bdb0e --- /dev/null +++ b/k3s-worker1.tf @@ -0,0 +1,64 @@ +resource "proxmox_virtual_environment_vm" "K3s-Worker1" { + + # VM General Settings + node_name = "prox" + vm_id = 310 + name = "K3s-Worker1" + description = "Kubernetes worker" + tags = ["tofu", "ubuntu-22", "auto-homelab-repo", "infrastructure"] + + agent { + enabled = false # read 'Qemu guest agent' section, change to true only when ready + } + + clone { + vm_id = 8000 + } + + # VM CPU Settings + cpu { + cores = 4 + type = "host" + } + + # VM Memory Settings + memory { + dedicated = 4096 + } + + # VM Network Settings + network_device { + bridge = "vmbr0" + vlan_id = 1 + } + + # VM Disk Settings + disk { + datastore_id = "Fast2Tb" + size = 100 + interface = "scsi0" + } + + vga { + type = "serial0" + } + + initialization { + ip_config { + ipv4 { + address = "dhcp" + } + } + + user_account {} + } + + lifecycle { + ignore_changes = [ + initialization[0].user_account[0].keys, + initialization[0].user_account[0].password, + initialization[0].user_account[0].username, + ] + } + +} diff --git a/k3s-worker2.tf b/k3s-worker2.tf new file mode 100644 index 0000000..b1eba5e --- /dev/null +++ b/k3s-worker2.tf @@ -0,0 +1,64 @@ +resource "proxmox_virtual_environment_vm" "K3s-Worker2" { + + # VM General Settings + node_name = "prox" + vm_id = 320 + name = "K3s-Worker2" + description = "Kubernetes worker" + tags = ["tofu", "ubuntu-22", "auto-homelab-repo", "infrastructure"] + + agent { + enabled = false # read 'Qemu guest agent' section, change to true only when ready + } + + clone { + vm_id = 8000 + } + + # VM CPU Settings + cpu { + cores = 4 + type = "host" + } + + # VM Memory Settings + memory { + dedicated = 4096 + } + + # VM Network Settings + network_device { + bridge = "vmbr0" + vlan_id = 1 + } + + # VM Disk Settings + disk { + datastore_id = "Fast2Tb" + size = 100 + interface = "scsi0" + } + + vga { + type = "serial0" + } + + initialization { + ip_config { + ipv4 { + address = "dhcp" + } + } + + user_account {} + } + + lifecycle { + ignore_changes = [ + initialization[0].user_account[0].keys, + initialization[0].user_account[0].password, + initialization[0].user_account[0].username, + ] + } + +}