From bacaa27c0b1b6f96f52d25240bfe9dd0bf17db9e Mon Sep 17 00:00:00 2001 From: vandomej Date: Fri, 3 Oct 2025 10:58:45 -0700 Subject: [PATCH] Changing domain to null resource --- control-plane/main.tf | 64 +++++++++++++++++++++++++++---------------- 1 file changed, 40 insertions(+), 24 deletions(-) diff --git a/control-plane/main.tf b/control-plane/main.tf index a448da2..31e8703 100644 --- a/control-plane/main.tf +++ b/control-plane/main.tf @@ -42,7 +42,7 @@ variable "talos_version" { } resource "libvirt_network" "talos_bridge" { - name = "my-talos-net" + name = "control-plane-net" autostart = true xml { @@ -50,8 +50,8 @@ resource "libvirt_network" "talos_bridge" { } } -resource "libvirt_pool" "images" { - name = "images" +resource "libvirt_pool" "talos-images" { + name = "talos-images" type = "dir" target { path = "/var/lib/libvirt/images/talos-kvm" @@ -61,7 +61,7 @@ resource "libvirt_pool" "images" { # Download the ISO resource "libvirt_volume" "talos_iso" { name = "talos-metal-arm64.iso" - pool = "images" + pool = "talos-images" source = "https://factory.talos.dev/image/4a0d65c669d46663f377e7161e50cfd570c401f26fd9e7bda34a0216b6f1922b/v1.11.1/metal-arm64.iso" format = "raw" } @@ -69,37 +69,53 @@ resource "libvirt_volume" "talos_iso" { # Create disk for VM resource "libvirt_volume" "control_plane_disk" { name = "control-plane-node-1-disk.qcow2" - pool = "images" + pool = "talos-images" base_volume_id = libvirt_volume.talos_iso.id size = 42949672960 # 40GB in bytes format = "qcow2" } # Create the VM -resource "libvirt_domain" "control_plane_node_1" { - name = "control-plane-node-1" - memory = 2048 - vcpu = 2 +resource "null_resource" "control_plane_node_1" { + depends_on = [ + libvirt_network.talos_bridge, + libvirt_volume.control_plane_disk, + libvirt_volume.talos_iso + ] - disk { - volume_id = libvirt_volume.control_plane_disk.id + triggers = { + cpus = var.vcpu_count, + memory = var.memory_mb, + cluster_name = var.cluster_name } - disk { - file = libvirt_volume.talos_iso.id + provisioner "local-exec" { + command = <