Wait for VM startup using guest agent exec
and cloud-init status --wait
#1576
Labels
✨ enhancement
New feature or request
exec
and cloud-init status --wait
#1576
Discussed in #389
Originally posted by satwell June 25, 2023
The PVE API exposes QEMU Guest Agent's "exec" support, which lets you execute a command on the guest as root. Is there some sensible way that support for this could be added to the provider?
Here's my use case. I'm using cloud-init for initial VM setup, but I'd like Terraform to wait until cloud-init has completed before considering creation complete. Cloud-init conveniently provides a
cloud-init status --wait
command that will run until cloud-init is done.I could just use a
remote-exec
provisioner to connect to the VM and run that command. But that requires setting up an ssh connection to it. Which means the ssh port needs to be reachable, keys are set up, the the username matches what the cloud-init image uses, etc. It would be a lot cleaner if I could just use the guest agent for this.In an ideal world, the proxmox provider would be able to define a new provisioner for VM resources that would use the guest agent to run commands. But from my quick investigation, it doesn't sound like there's any way in Terraform to create new provisioner types.
Are there other ways that would make sense to add support for the exec API? LIke an additional option in the vm resource type, or a new resource type? Or should I just find or write an external tool that uses the exec API and call it with a
local-exec
provisioner?The text was updated successfully, but these errors were encountered: