feat(vm): enable qemu-guest-agent and set stop_on_destroy
All checks were successful
Terraform Deploy / Validate (push) Successful in 14s
Terraform Deploy / Plan (push) Successful in 5s
Terraform Deploy / Apply (push) Has been skipped

- Add `qemu-guest-agent` enable/start command to `user-data.yml.tftpl` to ensure the agent is active immediately after provisioning.
- Set `stop_on_destroy = true` in the Proxmox VM resource definition to ensure graceful shutdown during Terraform destroy operations.
This commit is contained in:
darnodo
2025-12-11 19:12:31 +01:00
parent 2ce5c373f2
commit 6d7a0e64ab
2 changed files with 8 additions and 4 deletions

View File

@@ -25,5 +25,8 @@ packages:
# 5. Installation et configuration de Tailscale
runcmd:
# Enable and start qemu-guest-agent (systemd)
- [ systemctl, enable, qemu-guest-agent, --now ]
# Install and configure Tailscale
- [ sh, -c, "curl -fsSL https://tailscale.com/install.sh | sh" ]
- [ tailscale, up, --authkey=${tailscale_auth_key}, --hostname=${vm_name} ]

View File

@@ -24,10 +24,11 @@ locals {
resource "proxmox_virtual_environment_vm" "vms" {
for_each = var.virtual_machines
name = "${each.key}.${var.domain_suffix}"
node_name = var.target_node
tags = concat(["terraform-managed", "vm"], each.value.tags)
on_boot = lookup(each.value, "on_boot", true)
name = "${each.key}.${var.domain_suffix}"
node_name = var.target_node
tags = concat(["terraform-managed", "vm"], each.value.tags)
on_boot = lookup(each.value, "on_boot", true)
stop_on_destroy = true
# Configuration de l'agent QEMU
agent {