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

25 lines
779 B
Terraform
Raw Normal View History

2025-10-26 11:42:08 +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"]
iso_url = "${"https://factory.talos.dev/image"}/${local.schematic_id}/${var.talos_version}/nocloud-amd64.iso"
iso_file = "${var.iso_path}/talos-${local.schematic_id}-${var.talos_version}-nocloud-amd64.iso"
}
resource "null_resource" "download_iso" {
provisioner "local-exec" {
command = <<-EOT
mkdir -p ${var.iso_path}
if [ ! -f "${local.iso_file}" ]; then
curl -L -o "${local.iso_file}" "${local.iso_url}"
fi
EOT
}
}