resource "proxmox_virtual_environment_download_file" "latest_alpine" { content_type = "vztmpl" datastore_id = "local" node_name = "papp-bunt" url = "http://download.proxmox.com/images/system/alpine-3.20-default_20240908_amd64.tar.xz" } resource "proxmox_virtual_environment_container" "kube-template" { description = "Managed by Terraform" node_name = var.proxmox_node vm_id = var.vmid start_on_boot = "true" initialization { hostname = "kube-template" ip_config { ipv4 { address = "dhcp" } } user_account { password = var.user_password keys = var.ssh_keys } } network_interface { name = "eth0" } operating_system { template_file_id = proxmox_virtual_environment_download_file.latest_alpine.id type = "alpine" } startup { order = "3" } } resource "proxmox_virtual_environment_container" "kube-masters" { vm_id = var.vmid + count.index + 10 node_name = var.proxmox_node count = var.master_count initialization { # hostname = data.external.master_kube.result.name hostname = "kube-master-${tostring(count.index)}.kubes.42069.no" } operating_system { template_file_id = proxmox_virtual_environment_download_file.latest_alpine.id type = "alpine" } startup { order = "1" } provisioner "remote-exec" { inline = [ "dnf update -y" ] } } resource "proxmox_virtual_environment_container" "kube-workers" { vm_id = var.vmid + 100 + count.index node_name = var.proxmox_node count = var.worker_count initialization { # hostname = data.external.worker_kube.result.name hostname = "kube-worker-${tostring(count.index)}.kubes.42069.no" } operating_system { template_file_id = proxmox_virtual_environment_download_file.latest_alpine.id type = "alpine" } provisioner "remote-exec" { inline = [ "dnf update -y" ] } }