mirror of
https://github.com/optim-enterprises-bv/homelab.git
synced 2025-11-02 10:57:53 +00:00
feat(tofu): use new talos_image_factory_schematic resource
talos provider 0.6 added a new resource for generating the image schematic id
This commit is contained in:
@@ -2,11 +2,11 @@ terraform {
|
||||
required_providers {
|
||||
kubernetes = {
|
||||
source = "hashicorp/kubernetes"
|
||||
version = ">=2.31.0"
|
||||
version = ">=2.32.0"
|
||||
}
|
||||
proxmox = {
|
||||
source = "bpg/proxmox"
|
||||
version = ">=0.60.0"
|
||||
version = ">=0.66.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ terraform {
|
||||
required_providers {
|
||||
kubernetes = {
|
||||
source = "hashicorp/kubernetes"
|
||||
version = ">=2.31.0"
|
||||
version = ">=2.32.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,11 @@ terraform {
|
||||
required_providers {
|
||||
kubernetes = {
|
||||
source = "hashicorp/kubernetes"
|
||||
version = ">= 2.31.0"
|
||||
version = ">= 2.32.0"
|
||||
}
|
||||
restapi = {
|
||||
source = "Mastercard/restapi"
|
||||
version = ">= 1.19.1"
|
||||
version = ">= 1.12.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,8 +26,3 @@ output "talos_config" {
|
||||
value = module.talos.client_configuration.talos_config
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
output "image_schematic" {
|
||||
// "dcac6b92c17d1d8947a0cee5e0e6b6904089aa878c70d66196bb1138dbd05d1a"
|
||||
value = module.talos.schematic_id
|
||||
}
|
||||
@@ -1,56 +1,11 @@
|
||||
locals {
|
||||
version = var.image.version
|
||||
schematic = var.image.schematic
|
||||
schematic_id = jsondecode(data.http.schematic_id.response_body)["id"]
|
||||
#schematic_id = talos_image_factory_schematic.this.id
|
||||
image_id = "${local.schematic_id}_${local.version}"
|
||||
image_id = "${talos_image_factory_schematic.this.id}_${local.version}"
|
||||
|
||||
update_version = coalesce(var.image.update_version, var.image.version)
|
||||
update_schematic = coalesce(var.image.update_schematic, var.image.schematic)
|
||||
update_schematic_id = jsondecode(data.http.updated_schematic_id.response_body)["id"]
|
||||
#update_schematic_id = talos_image_factory_schematic.this.id
|
||||
update_image_id = "${local.update_schematic_id}_${local.update_version}"
|
||||
}
|
||||
|
||||
data "http" "schematic_id" {
|
||||
url = "${var.image.factory_url}/schematics"
|
||||
method = "POST"
|
||||
request_body = local.schematic
|
||||
}
|
||||
|
||||
data "http" "updated_schematic_id" {
|
||||
url = "${var.image.factory_url}/schematics"
|
||||
method = "POST"
|
||||
request_body = local.update_schematic
|
||||
}
|
||||
|
||||
/* Testing out new provider schematic feature */
|
||||
|
||||
data "talos_image_factory_extensions_versions" "this" {
|
||||
talos_version = var.image.version
|
||||
filters = {
|
||||
names = [
|
||||
"i915-ucode",
|
||||
"intel-ucode",
|
||||
"qemu-guest-agent"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
resource "talos_image_factory_schematic" "generated" {
|
||||
schematic = yamlencode(
|
||||
{
|
||||
customization = {
|
||||
systemExtensions = {
|
||||
officialExtensions = data.talos_image_factory_extensions_versions.this.extensions_info.*.name
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
output "schematic_id" {
|
||||
value = talos_image_factory_schematic.generated.id
|
||||
update_image_id = "${talos_image_factory_schematic.updated.id}_${local.update_version}"
|
||||
}
|
||||
|
||||
resource "talos_image_factory_schematic" "this" {
|
||||
@@ -61,8 +16,6 @@ resource "talos_image_factory_schematic" "updated" {
|
||||
schematic = local.update_schematic
|
||||
}
|
||||
|
||||
/* Testing out new provider schematic feature */
|
||||
|
||||
resource "proxmox_virtual_environment_download_file" "this" {
|
||||
for_each = toset(distinct([for k, v in var.nodes : "${v.host_node}_${v.update == true ? local.update_image_id : local.image_id}"]))
|
||||
|
||||
|
||||
@@ -2,11 +2,11 @@ terraform {
|
||||
required_providers {
|
||||
proxmox = {
|
||||
source = "bpg/proxmox"
|
||||
version = ">=0.60.0"
|
||||
version = ">=0.66.1"
|
||||
}
|
||||
talos = {
|
||||
source = "siderolabs/talos"
|
||||
version = ">=0.6.0-alpha.1"
|
||||
version = ">=0.6.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user