infrastructure/pve01.wheatley.in/k8s-wheatley/modules/talos-node/main.tf

83 lines
1.5 KiB
Terraform
Raw Normal View History

2025-10-28 22:45:12 +01:00
terraform {
required_providers {
proxmox = {
source = "bpg/proxmox"
2025-11-15 18:47:57 +01:00
version = "0.86.0"
2025-10-28 22:45:12 +01:00
}
}
}
resource "proxmox_virtual_environment_vm" "talos-node" {
2025-10-31 17:24:40 +01:00
vm_id = var.node.id
2025-10-28 22:45:12 +01:00
name = var.node.name
node_name = var.node.proxmox_node
tags = ["tofu"]
bios = "ovmf"
on_boot = true
machine = "q35"
stop_on_destroy = true
operating_system {
type = "l26"
}
agent {
enabled = true
}
cpu {
cores = var.node.cpu
sockets = 1
type = "x86-64-v2-AES"
}
memory {
dedicated = var.node.memory * 1024
}
disk {
datastore_id = var.node.storagepool
interface = "virtio0"
2025-11-15 18:47:20 +01:00
import_from = var.talos_image_id
2025-10-28 22:45:12 +01:00
size = var.node.disk
file_format = "raw"
}
2025-11-15 18:47:20 +01:00
dynamic "disk" {
for_each = tolist(var.pvc_disks)
content {
datastore_id = "nvme-fastpool"
interface = "virtio${disk.key + 1}"
size = disk.value
file_format = "raw"
}
2025-10-28 22:45:12 +01:00
}
efi_disk {
datastore_id = var.node.storagepool
file_format = "raw"
type = "4m"
}
tpm_state {
datastore_id = var.node.storagepool
version = "v2.0"
}
initialization {
datastore_id = var.node.storagepool
ip_config {
ipv4 {
address = format("%s/24", var.node.ipv4_address)
gateway = var.node.ipv4_gateway
}
}
dns {
servers = ["10.13.37.2"]
}
}
network_device {
bridge = "vmbr1"
}
}