proxmox-kube/kubes.tf

81 lines
1.6 KiB
Terraform
Raw Normal View History

2024-10-16 09:13:28 +00:00
resource "proxmox_vm_qemu" "kube-masters" {
count = var.master_count
# name = "kube-master-${count.index + 1}"
name = data.external.master_kube.result.name
vmid = var.vmid + count.index
target_node = var.proxmox_host
clone = var.template_name
sshkeys = var.ssh_keys
agent = 1
os_type = "cloud-init"
sockets = 1
cores = 1
cpu = "host"
memory = 2048
# scsihw = "virtio-scsi-pci"
bootdisk = "virtio0"
disk {
slot = 0
size = "8G"
type = "virtio"
storage = "thic"
iothread = 1
}
network {
model = "virtio"
bridge = "vmbr0"
}
lifecycle {
ignore_changes = [
network,
]
}
provisioner "remote-exec" {
inline = [
"apt update",
"apt upgrade -y"
]
}
}
resource "proxmox_vm_qemu" "kube-workers" {
count = var.worker_count
# name = "kube-worker-${count.index + 1}"
name = data.external.worker_kube.result.name
vmid = var.vmid + 100 + count.index
target_node = var.proxmox_host
clone = var.template_name
agent = 1 # QEMU Guest Agent
os_type = "cloud-init"
sockets = 1
cores = 2
cpu = "host"
memory = 4096
# scsihw = "virtio-scsi-pci"
bootdisk = "virtio0"
disk {
slot = 0
size = "8G"
type = "virtio"
storage = "thic"
iothread = 1
}
network {
model = "virtio"
bridge = "vmbr0"
}
lifecycle {
ignore_changes = [
network,
]
}
sshkeys = var.ssh_keys
provisioner "remote-exec" {
inline = [
"apt update",
"apt upgrade -y"
]
}
}