From 92e5976f1dad14d8c8c7e0b57f8b0d1c482fd843 Mon Sep 17 00:00:00 2001 From: juvdiaz Date: Fri, 26 Jun 2026 23:32:10 -0600 Subject: [PATCH] Fix Pimox template replacement lifecycle --- bootstrap/provisioning/main.tf | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/bootstrap/provisioning/main.tf b/bootstrap/provisioning/main.tf index 627e851..fc2d23d 100644 --- a/bootstrap/provisioning/main.tf +++ b/bootstrap/provisioning/main.tf @@ -119,21 +119,20 @@ resource "null_resource" "pimox_template_vm_create" { depends_on = [null_resource.provisioning_host] triggers = { - pimox_host = var.pimox_host - pimox_user = var.pimox_user - ssh_key_path = var.pimox_ssh_key_path - qm_bin = var.pimox_qm_bin - builder_version = "5" - config_hash = local.config_hash - vmid = tostring(var.pimox_template_vmid) - name = var.pimox_template_name - cores = tostring(var.pimox_template_cores) - memory = tostring(var.pimox_template_memory) - bridge = var.pimox_template_bridge - net0 = local.pimox_template_net0 - scsi0 = var.pimox_template_scsi0 - efidisk0 = var.pimox_template_efidisk0 - replace_existing = tostring(var.pimox_template_replace_existing) + pimox_host = var.pimox_host + pimox_user = var.pimox_user + ssh_key_path = var.pimox_ssh_key_path + qm_bin = var.pimox_qm_bin + builder_version = "5" + config_hash = local.config_hash + vmid = tostring(var.pimox_template_vmid) + name = var.pimox_template_name + cores = tostring(var.pimox_template_cores) + memory = tostring(var.pimox_template_memory) + bridge = var.pimox_template_bridge + net0 = local.pimox_template_net0 + scsi0 = var.pimox_template_scsi0 + efidisk0 = var.pimox_template_efidisk0 } connection { @@ -149,7 +148,7 @@ resource "null_resource" "pimox_template_vm_create" { set -eu vmid="${self.triggers.vmid}" -replace_existing="${self.triggers.replace_existing}" +replace_existing="${var.pimox_template_replace_existing}" qm_cmd="${self.triggers.qm_bin}" if [ ! -x "$qm_cmd" ]; then @@ -233,6 +232,7 @@ resource "null_resource" "pimox_template_vm_seal" { guest_user = var.pimox_template_build_user guest_key_path = var.pimox_template_build_ssh_key_path seal_version = "5" + create_id = null_resource.pimox_template_vm_create[0].id config_hash = local.config_hash timeout = var.pimox_template_build_timeout timeout_seconds = tostring(var.pimox_template_build_timeout_seconds)