Fix Pimox template replacement lifecycle

This commit is contained in:
juvdiaz 2026-06-26 23:32:10 -06:00
parent d90ffe5b14
commit 92e5976f1d
1 changed files with 16 additions and 16 deletions

View File

@ -119,21 +119,20 @@ resource "null_resource" "pimox_template_vm_create" {
depends_on = [null_resource.provisioning_host] depends_on = [null_resource.provisioning_host]
triggers = { triggers = {
pimox_host = var.pimox_host pimox_host = var.pimox_host
pimox_user = var.pimox_user pimox_user = var.pimox_user
ssh_key_path = var.pimox_ssh_key_path ssh_key_path = var.pimox_ssh_key_path
qm_bin = var.pimox_qm_bin qm_bin = var.pimox_qm_bin
builder_version = "5" builder_version = "5"
config_hash = local.config_hash config_hash = local.config_hash
vmid = tostring(var.pimox_template_vmid) vmid = tostring(var.pimox_template_vmid)
name = var.pimox_template_name name = var.pimox_template_name
cores = tostring(var.pimox_template_cores) cores = tostring(var.pimox_template_cores)
memory = tostring(var.pimox_template_memory) memory = tostring(var.pimox_template_memory)
bridge = var.pimox_template_bridge bridge = var.pimox_template_bridge
net0 = local.pimox_template_net0 net0 = local.pimox_template_net0
scsi0 = var.pimox_template_scsi0 scsi0 = var.pimox_template_scsi0
efidisk0 = var.pimox_template_efidisk0 efidisk0 = var.pimox_template_efidisk0
replace_existing = tostring(var.pimox_template_replace_existing)
} }
connection { connection {
@ -149,7 +148,7 @@ resource "null_resource" "pimox_template_vm_create" {
set -eu set -eu
vmid="${self.triggers.vmid}" vmid="${self.triggers.vmid}"
replace_existing="${self.triggers.replace_existing}" replace_existing="${var.pimox_template_replace_existing}"
qm_cmd="${self.triggers.qm_bin}" qm_cmd="${self.triggers.qm_bin}"
if [ ! -x "$qm_cmd" ]; then if [ ! -x "$qm_cmd" ]; then
@ -233,6 +232,7 @@ resource "null_resource" "pimox_template_vm_seal" {
guest_user = var.pimox_template_build_user guest_user = var.pimox_template_build_user
guest_key_path = var.pimox_template_build_ssh_key_path guest_key_path = var.pimox_template_build_ssh_key_path
seal_version = "5" seal_version = "5"
create_id = null_resource.pimox_template_vm_create[0].id
config_hash = local.config_hash config_hash = local.config_hash
timeout = var.pimox_template_build_timeout timeout = var.pimox_template_build_timeout
timeout_seconds = tostring(var.pimox_template_build_timeout_seconds) timeout_seconds = tostring(var.pimox_template_build_timeout_seconds)