2025-10-24 23:41:05 +02:00
|
|
|
terraform {
|
|
|
|
|
required_providers {
|
|
|
|
|
proxmox = {
|
2025-10-26 18:14:46 +01:00
|
|
|
source = "bpg/proxmox"
|
|
|
|
|
version = "0.85.1"
|
|
|
|
|
}
|
|
|
|
|
talos = {
|
|
|
|
|
source = "siderolabs/talos"
|
|
|
|
|
version = "0.9.0"
|
2025-10-24 23:41:05 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2025-10-26 18:14:46 +01:00
|
|
|
resource "proxmox_virtual_environment_vm" "controlplane" {
|
2025-10-24 23:41:05 +02:00
|
|
|
|
2025-10-26 18:14:46 +01:00
|
|
|
name = var.controlplane.node_name
|
|
|
|
|
node_name = "pve01"
|
|
|
|
|
tags = ["tofu"]
|
|
|
|
|
bios = "ovmf"
|
|
|
|
|
on_boot = true
|
|
|
|
|
machine = "q35"
|
|
|
|
|
stop_on_destroy = true
|
|
|
|
|
|
|
|
|
|
operating_system {
|
|
|
|
|
type = "l26"
|
|
|
|
|
}
|
|
|
|
|
agent {
|
|
|
|
|
enabled = true
|
2025-10-24 23:41:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cpu {
|
2025-10-26 18:14:46 +01:00
|
|
|
cores = var.controlplane.cpu
|
2025-10-24 23:41:05 +02:00
|
|
|
sockets = 1
|
2025-10-26 18:14:46 +01:00
|
|
|
type = "x86-64-v2-AES"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
memory {
|
|
|
|
|
dedicated = var.controlplane.memory * 1024
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
disk {
|
|
|
|
|
datastore_id = var.controlplane.storagepool
|
|
|
|
|
interface = "virtio0"
|
|
|
|
|
aio = "io_uring"
|
|
|
|
|
size = var.controlplane.disk * 1024
|
|
|
|
|
file_format = "raw"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cdrom {
|
|
|
|
|
file_id = format("local:iso/talos-%s-nocloud-amd64-secureboot.iso", var.controlplane.talos_version)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
efi_disk {
|
|
|
|
|
datastore_id = var.controlplane.storagepool
|
|
|
|
|
file_format = "raw"
|
|
|
|
|
type = "4m"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tpm_state {
|
|
|
|
|
datastore_id = var.controlplane.storagepool
|
|
|
|
|
version = "v2.0"
|
2025-10-24 23:41:05 +02:00
|
|
|
}
|
|
|
|
|
|
2025-10-26 18:14:46 +01:00
|
|
|
initialization {
|
|
|
|
|
datastore_id = var.controlplane.storagepool
|
|
|
|
|
ip_config {
|
|
|
|
|
ipv4 {
|
|
|
|
|
address = var.controlplane.node_ipv4_address
|
|
|
|
|
gateway = var.controlplane.ipv4_gateway
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
dns {
|
|
|
|
|
servers = ["10.13.37.2"]
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-10-24 23:41:05 +02:00
|
|
|
|
2025-10-26 18:14:46 +01:00
|
|
|
network_device {
|
2025-10-24 23:41:05 +02:00
|
|
|
bridge = "vmbr1"
|
|
|
|
|
}
|
2025-10-26 18:14:46 +01:00
|
|
|
|
2025-10-24 23:41:05 +02:00
|
|
|
}
|
2025-10-26 18:14:46 +01:00
|
|
|
|
|
|
|
|
# resource "talos_machine_secrets" "controlplane" {
|
|
|
|
|
# talos_version = var.controlplane.talos_version
|
|
|
|
|
# }
|
|
|
|
|
#
|
|
|
|
|
# data "talos_client_configuration" "controlplane" {
|
|
|
|
|
# cluster_name = var.controlplane.cluster_name
|
|
|
|
|
# client_configuration = talos_machine_secrets.controlplane.client_configuration
|
|
|
|
|
# nodes = [for k, v in var.controlplane : v.ip]
|
|
|
|
|
# endpoints = [var.controlplane.cluster_endpoint]
|
|
|
|
|
# }
|