terraform { required_version = ">= 1.0" required_providers { talos = { source = "siderolabs/talos" version = "~> 0.9" } libvirt = { source = "dmacvicar/libvirt" version = "~> 0.7" } } } provider "libvirt" { uri = "qemu:///system" } # Load variables from a .tfvars file variable "cluster_name" { description = "The name of the Talos cluster" type = string default = "evolved-npcs-cluster" } variable "memory_mb" { description = "Memory for each VM in MB" type = number default = 2048 } variable "vcpu_count" { description = "Number of vCPUs for each VM" type = number default = 2 } variable "talos_version" { description = "The version of Talos to use" type = string default = "v1.11.1" } resource "libvirt_network" "talos_bridge" { name = "control-plane-net" autostart = true xml { xslt = file("control-plane-net.xsl") } } resource "libvirt_pool" "talos-images" { name = "talos-images" type = "dir" target { path = "/var/lib/libvirt/images/talos-kvm" } } # Download the ISO resource "libvirt_volume" "talos_iso" { name = "talos-metal-arm64.iso" pool = "talos-images" source = "https://factory.talos.dev/image/4a0d65c669d46663f377e7161e50cfd570c401f26fd9e7bda34a0216b6f1922b/v1.11.1/metal-arm64.iso" format = "raw" } # Create disk for VM resource "libvirt_volume" "control_plane_disk" { name = "control-plane-node-1-disk.qcow2" pool = "talos-images" size = 42949672960 # 40GB in bytes format = "qcow2" } # Create the VM resource "null_resource" "control_plane_node_1" { depends_on = [ libvirt_network.talos_bridge, libvirt_volume.control_plane_disk, libvirt_volume.talos_iso ] triggers = { cpus = var.vcpu_count, memory = var.memory_mb, cluster_name = var.cluster_name } provisioner "local-exec" { command = <