Skip to content

Instantly share code, notes, and snippets.

@bvierra
Created December 1, 2025 21:55
Show Gist options
  • Select an option

  • Save bvierra/8a4cb08e48f4ad84b0cb037a97423eb0 to your computer and use it in GitHub Desktop.

Select an option

Save bvierra/8a4cb08e48f4ad84b0cb037a97423eb0 to your computer and use it in GitHub Desktop.
proxmox talos
# resource "proxmox_virtual_environment_file" "cloud_init_user_data" {
# for_each = local.all_nodes_transformed
# content_type = "snippets"
# datastore_id = "proxmox-nfs"
# node_name = each.value.deploy_to
# source_raw {
# data = each.value.user_data
# file_name = "talos-${each.key}-user-data.yml"
# }
# }
resource "proxmox_virtual_environment_vm" "vm" {
depends_on = [proxmox_virtual_environment_download_file.talos-iso]
for_each = local.all_nodes_transformed
name = each.value.name
node_name = each.value.deploy_to
description = "Managed by Terraform"
tags = each.value.tags
vm_id = each.value.vmid
machine = "q35"
scsi_hardware = "virtio-scsi-single"
bios = "ovmf"
tablet_device = false
timeout_create = 480
timeout_stop_vm = 300
timeout_shutdown_vm = 900
started = each.value.onboot
agent {
enabled = true
}
efi_disk {
datastore_id = "proxmox-nfs"
pre_enrolled_keys = false
file_format = "raw"
type = "4m"
}
tpm_state {
datastore_id = "proxmox-nfs"
version = "v2.0"
}
cpu {
cores = each.value.cores
sockets = each.value.sockets
type = "host"
}
memory {
dedicated = each.value.memory * 1024
floating = each.value.memory * 1024
}
operating_system {
type = "l26"
}
initialization {
datastore_id = "proxmox-nfs"
#user_data_file_id = proxmox_virtual_environment_file.cloud_init_user_data[each.key].id
ip_config {
ipv4 {
address = "${each.value.ip}/24"
gateway = each.value.gateway
}
}
ip_config {
ipv4 {
address = "${each.value.ip2}/24"
}
}
dns {
servers = local.dns_server
domain = local.dns_search
}
}
stop_on_destroy = true
boot_order = ["virtio0","ide3"]
cdrom {
interface = "ide3"
file_id = proxmox_virtual_environment_download_file.talos-iso.id
}
serial_device {}
network_device {
bridge = each.value.network_bridge
model = each.value.network_model
mac_address = each.value.mac_address
# vlan_id = local.vlan1_id
}
network_device {
bridge = each.value.network_bridge2
model = each.value.network_model
mac_address = each.value.mac_address2
mtu = 9000
}
disk {
interface = "virtio0"
size = tonumber(trimsuffix(each.value.disk_size, "G"))
datastore_id = local.disk_storage
file_format = "qcow2"
iothread = true
cache = "writethrough"
discard = "on"
}
# disk {
# interface = "scsi0"
# datastore_id = local.disk_storage
# import_from = proxmox_virtual_environment_file.talos_iso.id
# size = tonumber(trimsuffix(each.value.disk_size, "G"))
# }
lifecycle {
ignore_changes = [
tags
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment