infrastructure/pve01.wheatley.in/templates/talos/main.tf
Renovate 740b08afae
All checks were successful
Tofu Plan k8s-wheatley / tofu-plan-k8s-wheatley (pull_request) Successful in 44s
Tofu Plan pve01.wheatley.in templates / tofu-plan-templates (pull_request) Successful in 1m0s
chore(deps): update terraform proxmox to v0.99.0
2026-03-24 00:01:41 +00:00

78 lines
1.7 KiB
HCL

terraform {
required_providers {
proxmox = {
source = "bpg/proxmox"
version = "0.99.0"
}
}
}
data "http" "schematic" {
url = "https://factory.talos.dev/schematics"
method = "POST"
request_body = file("${path.module}/schematic.yaml")
request_headers = {
"Content-Type" = "application/x-yaml"
}
}
locals {
schematic_id = jsondecode(data.http.schematic.response_body)["id"]
storagepool = "nvme-fastpool"
}
resource "proxmox_virtual_environment_download_file" "talos-image" {
for_each = toset(var.talos_versions)
node_name = "pve01"
datastore_id = "local"
content_type = "iso"
url = "https://factory.talos.dev/image/${local.schematic_id}/v${each.value}/nocloud-amd64-secureboot.iso"
file_name = "talos-${each.value}-nocloud-amd64-secureboot.iso"
}
resource "proxmox_virtual_environment_vm" "talos-template" {
depends_on = [proxmox_virtual_environment_download_file.talos-image]
for_each = toset(var.talos_versions)
template = true
vm_id = 10000 + tonumber(replace(each.value, ".", ""))
name = "talos-template-${each.value}"
node_name = "pve01"
tags = ["tofu"]
bios = "ovmf"
on_boot = true
machine = "q35"
operating_system {
type = "l26"
}
agent {
enabled = true
}
cpu {
cores = 2
sockets = 1
type = "host"
}
memory {
dedicated = 2048
}
disk {
datastore_id = local.storagepool
interface = "virtio0"
file_id = proxmox_virtual_environment_download_file.talos-image[each.value].id
file_format = "raw"
}
efi_disk {
datastore_id = local.storagepool
file_format = "raw"
type = "4m"
}
tpm_state {
datastore_id = local.storagepool
version = "v2.0"
}
}