feat: Boot from imported image

This commit is contained in:
Peter 2025-11-15 18:47:20 +01:00
parent 7c234a73d1
commit 0e0b848d07
Signed by: Peter
SSH key fingerprint: SHA256:B5tYaxBExaDm74r1px9iVeZ6F/ZDiyiy9SbBqfZYrvg
3 changed files with 36 additions and 17 deletions

View file

@ -2,7 +2,7 @@ terraform {
required_providers {
proxmox = {
source = "bpg/proxmox"
version = "0.85.1"
version = "0.86.0"
}
}
}
@ -18,17 +18,28 @@ data "http" "schematic" {
locals {
schematic_id = jsondecode(data.http.schematic.response_body)["id"]
iso_url = "${"https://factory.talos.dev/image"}/${local.schematic_id}/v${var.talos_version}/nocloud-amd64-secureboot.iso"
iso_file = "talos-${var.talos_version}-nocloud-amd64-secureboot.iso"
iso_url = "${"https://factory.talos.dev/image"}/${local.schematic_id}/v${var.talos_version}/nocloud-amd64-secureboot.raw.xz"
iso_file = "talos-${var.talos_version}-nocloud-amd64-secureboot.raw"
}
resource "proxmox_virtual_environment_download_file" "talos-image" {
node_name = "pve01"
content_type = "iso"
datastore_id = "local"
overwrite = true
url = local.iso_url
file_name = local.iso_file
resource "null_resource" "local_download_talos_image" {
provisioner "local-exec" {
command = <<EOT
curl -L ${local.iso_url} -o ${path.module}/${local.iso_file}.xz
xz -d ${path.module}/${local.iso_file}.xz
EOT
}
}
resource "proxmox_virtual_environment_file" "talos-image" {
depends_on = [null_resource.local_download_talos_image]
node_name = "pve01"
content_type = "import"
datastore_id = "local"
overwrite = true
source_file {
path = "${path.module}/${local.iso_file}"
}
}