resource "proxmox_download_file" "arch_qcow" { for_each = data.proxmox_virtual_environment_node.hvc01 checksum = local.arch_qcow_hash checksum_algorithm = "sha256" content_type = "import" datastore_id = "local" file_name = "archlinux_cloudimg_amd64.qcow2" node_name = each.value.id overwrite = true overwrite_unmanaged = true upload_timeout = 300 url = "https://${var.arch_mirror}/images/latest/Arch-Linux-x86_64-cloudimg.qcow2" verify = true } resource "proxmox_virtual_environment_pool" "this" { comment = "Container hosts and download client" pool_id = "archlinux" } resource "proxmox_virtual_environment_vm" "this" { for_each = var.vm_guests acpi = false agent { enabled = true timeout = "10m" trim = false type = "virtio" wait_for_ip { disabled = false ipv4 = true ipv6 = true } } audio_device { enabled = false } bios = "ovmf" cpu { # architecture = "x86_64" cores = 1 flags = ["+aes"] hotplugged = 0 limit = 0 numa = false sockets = 1 type = "x86-64-v2" units = 100 } description = "Arch Linux container host" disk { aio = "io_uring" backup = true cache = "none" datastore_id = "local-lvm" discard = "ignore" file_format = "raw" file_id = proxmox_download_file.arch_qcow[each.value.host].id interface = "virtio0" iothread = false replicate = true size = 64 } dynamic "disk" { for_each = each.value.role == "container_host" ? [1] : [] content { aio = "io_uring" backup = true cache = "none" datastore_id = "local-lvm" discard = "ignore" file_format = "raw" interface = "virtio1" iothread = false replicate = true size = 128 } } efi_disk { datastore_id = "local-lvm" file_format = "raw" type = "4m" pre_enrolled_keys = false } tpm_state { datastore_id = "local-lvm" version = "v2.0" } hotplug = "network,disk,usb" initialization { datastore_id = "local-lvm" interface = "sata0" file_format = "raw" dns { domain = var.local_domain servers = concat(var.ipv4_nameservers, var.ipv6_nameservers) } ip_config { ipv4 { address = "${data.dns_a_record_set.guests[each.key].addrs[0]}/${var.ipv4_subnet_mask}" gateway = var.ipv4_gateway } ipv6 { address = "${data.dns_aaaa_record_set.guests[each.key].addrs[0]}/64" gateway = var.ipv6_gateway } } user_account { keys = [ local.arch_public_key ] password = random_password.this[each.key].result username = var.arch_username } } keyboard_layout = "en-us" machine = "q35" memory { dedicated = 2048 floating = 2048 shared = 0 } migrate = true name = each.key network_device { bridge = "vmbr0" disconnected = false firewall = false model = "virtio" mtu = 1 } node_name = each.value.host on_boot = true operating_system { type = "l26" } pool_id = proxmox_virtual_environment_pool.this.pool_id protection = false reboot = false reboot_after_update = true started = true startup{ order = 1 up_delay = 20 } tablet_device = false stop_on_destroy = true purge_on_destroy = true delete_unreferenced_disks_on_destroy = true vga { type = "qxl" } watchdog { enabled = false action = "reset" model = "i6300esb" } }