mirror of
https://github.com/outbackdingo/homelab-v.git
synced 2026-08-25 14:53:19 +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 {
|
required_providers {
|
||||||
kubernetes = {
|
kubernetes = {
|
||||||
source = "hashicorp/kubernetes"
|
source = "hashicorp/kubernetes"
|
||||||
version = ">=2.31.0"
|
version = ">=2.32.0"
|
||||||
}
|
}
|
||||||
proxmox = {
|
proxmox = {
|
||||||
source = "bpg/proxmox"
|
source = "bpg/proxmox"
|
||||||
version = ">=0.60.0"
|
version = ">=0.66.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ terraform {
|
|||||||
required_providers {
|
required_providers {
|
||||||
kubernetes = {
|
kubernetes = {
|
||||||
source = "hashicorp/kubernetes"
|
source = "hashicorp/kubernetes"
|
||||||
version = ">=2.31.0"
|
version = ">=2.32.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ terraform {
|
|||||||
required_providers {
|
required_providers {
|
||||||
kubernetes = {
|
kubernetes = {
|
||||||
source = "hashicorp/kubernetes"
|
source = "hashicorp/kubernetes"
|
||||||
version = ">= 2.31.0"
|
version = ">= 2.32.0"
|
||||||
}
|
}
|
||||||
restapi = {
|
restapi = {
|
||||||
source = "Mastercard/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
|
value = module.talos.client_configuration.talos_config
|
||||||
sensitive = true
|
sensitive = true
|
||||||
}
|
}
|
||||||
|
|
||||||
output "image_schematic" {
|
|
||||||
// "dcac6b92c17d1d8947a0cee5e0e6b6904089aa878c70d66196bb1138dbd05d1a"
|
|
||||||
value = module.talos.schematic_id
|
|
||||||
}
|
|
||||||
@@ -1,56 +1,11 @@
|
|||||||
locals {
|
locals {
|
||||||
version = var.image.version
|
version = var.image.version
|
||||||
schematic = var.image.schematic
|
schematic = var.image.schematic
|
||||||
schematic_id = jsondecode(data.http.schematic_id.response_body)["id"]
|
image_id = "${talos_image_factory_schematic.this.id}_${local.version}"
|
||||||
#schematic_id = talos_image_factory_schematic.this.id
|
|
||||||
image_id = "${local.schematic_id}_${local.version}"
|
|
||||||
|
|
||||||
update_version = coalesce(var.image.update_version, var.image.version)
|
update_version = coalesce(var.image.update_version, var.image.version)
|
||||||
update_schematic = coalesce(var.image.update_schematic, var.image.schematic)
|
update_schematic = coalesce(var.image.update_schematic, var.image.schematic)
|
||||||
update_schematic_id = jsondecode(data.http.updated_schematic_id.response_body)["id"]
|
update_image_id = "${talos_image_factory_schematic.updated.id}_${local.update_version}"
|
||||||
#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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "talos_image_factory_schematic" "this" {
|
resource "talos_image_factory_schematic" "this" {
|
||||||
@@ -61,8 +16,6 @@ resource "talos_image_factory_schematic" "updated" {
|
|||||||
schematic = local.update_schematic
|
schematic = local.update_schematic
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Testing out new provider schematic feature */
|
|
||||||
|
|
||||||
resource "proxmox_virtual_environment_download_file" "this" {
|
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}"]))
|
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 {
|
required_providers {
|
||||||
proxmox = {
|
proxmox = {
|
||||||
source = "bpg/proxmox"
|
source = "bpg/proxmox"
|
||||||
version = ">=0.60.0"
|
version = ">=0.66.1"
|
||||||
}
|
}
|
||||||
talos = {
|
talos = {
|
||||||
source = "siderolabs/talos"
|
source = "siderolabs/talos"
|
||||||
version = ">=0.6.0-alpha.1"
|
version = ">=0.6.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user