2025-10-26 18:14:24 +01:00
|
|
|
terraform {
|
|
|
|
|
required_providers {
|
|
|
|
|
proxmox = {
|
|
|
|
|
source = "bpg/proxmox"
|
2025-11-15 18:47:20 +01:00
|
|
|
version = "0.86.0"
|
2025-10-26 18:14:24 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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"]
|
2025-11-15 18:47:20 +01:00
|
|
|
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"
|
2025-10-26 18:14:24 +01:00
|
|
|
}
|
|
|
|
|
|
2025-11-15 18:47:20 +01:00
|
|
|
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
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-10-26 18:14:24 +01:00
|
|
|
|
2025-11-15 18:47:20 +01:00
|
|
|
resource "proxmox_virtual_environment_file" "talos-image" {
|
|
|
|
|
depends_on = [null_resource.local_download_talos_image]
|
2025-10-26 18:14:24 +01:00
|
|
|
|
2025-11-15 18:47:20 +01:00
|
|
|
node_name = "pve01"
|
|
|
|
|
content_type = "import"
|
|
|
|
|
datastore_id = "local"
|
|
|
|
|
overwrite = true
|
|
|
|
|
|
|
|
|
|
source_file {
|
|
|
|
|
path = "${path.module}/${local.iso_file}"
|
|
|
|
|
}
|
2025-10-26 18:14:24 +01:00
|
|
|
}
|