Files
homelab/terraform/talos_schematic.tf

69 lines
2.2 KiB
Terraform

# Talos Image Factory schematic with Longhorn dependencies
resource "talos_image_factory_schematic" "longhorn" {
schematic = jsonencode({
customization = {
systemExtensions = {
officialExtensions = [
"siderolabs/iscsi-tools",
"siderolabs/util-linux-tools",
]
}
}
})
}
# Generate installer image URL for the schematic
data "talos_image_factory_urls" "longhorn_installer" {
talos_version = var.talos_version
schematic_id = talos_image_factory_schematic.longhorn.id
platform = "metal"
}
# GPU-enabled schematic with NVIDIA drivers and toolkit (+ Longhorn deps, since
# worker nodes also run the Longhorn CSI DaemonSet).
# LTS channel (580.xx), not production (595.xx) -- Tesla V100 (Volta) is on
# NVIDIA's Legacy driver branch; the 595.xx production driver ignores it entirely
# ("NVRM: No NVIDIA GPU found").
resource "talos_image_factory_schematic" "gpu_enabled" {
schematic = jsonencode({
customization = {
systemExtensions = {
officialExtensions = [
"siderolabs/iscsi-tools",
"siderolabs/util-linux-tools",
"siderolabs/nonfree-kmod-nvidia-lts",
"siderolabs/nvidia-container-toolkit-lts",
]
}
}
})
}
# Generate installer image URL for GPU schematic
data "talos_image_factory_urls" "gpu_installer" {
talos_version = var.talos_version
schematic_id = talos_image_factory_schematic.gpu_enabled.id
platform = "metal"
}
# Output the schematic ID and installer URL for reference
output "talos_schematic_id" {
value = talos_image_factory_schematic.longhorn.id
description = "Talos Image Factory schematic ID with Longhorn dependencies"
}
output "talos_gpu_schematic_id" {
value = talos_image_factory_schematic.gpu_enabled.id
description = "Talos Image Factory schematic ID with GPU (NVIDIA driver + container toolkit)"
}
output "talos_installer_url" {
value = data.talos_image_factory_urls.longhorn_installer.urls.installer
description = "Talos installer image URL with iscsi-tools and util-linux-tools"
}
output "talos_gpu_installer_url" {
value = data.talos_image_factory_urls.gpu_installer.urls.installer
description = "Talos installer image URL with NVIDIA GPU drivers and container toolkit"
}