-
Notifications
You must be signed in to change notification settings - Fork 459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adds wait_for_shutoff to resource_libvirt_domain #1066
base: main
Are you sure you want to change the base?
adds wait_for_shutoff to resource_libvirt_domain #1066
Conversation
While I acknowledge the problem, I am not sure we are fixing it in the right place.
|
I don't think cloud providers ultimately need to destroy the resource to update it e.g. scaling up typically requires just rebooting the node. This is mostly a TF'isum, where it's just easier to think of the resources as immutable. To my knowledge, the cloud providers that I'm aware of don't do graceful shutdowns on destroying (Digital Ocean and Azure).
IMO, this ultimately should be opt-in - as there are a lot of cases that would prevent libvirt from communicating with the guest for a graceful shutdown. Some OS's don't even respond to graceful shutdowns, one being at least some versions of VyOS (a router OS, "common" in public clouds). I also don't believe the agent is installed by default in at least the slim version of Ubuntu Server. |
Yes, it is a good solution. I hope people don't confuse it with the destroy timeout that terraform provides as a setting (which is the timeout of the destroy function itself). |
Here is a link to an implementation of this issue that I worked on some time ago, which may provide an alternative perspective: I have successfully used this solution in my projects without encountering any problems. It leverages the "running" attribute to shut down the virtual machine, utilizing the graceful default shutdown method or the QEMU agent (if specified), and, as a last resort, forcibly powers off the machine if the default Terraform method timeout is reached. If you'd like to test it quickly, you can use the associated Terraform provider available here: Terraform Provider. I hope this helps in some way |
Open to feedback, there is likely a better way to implement this. I took a first swing at the docs, but I wasn't sure where to start on testing.
Tested with Terraform version 1.7.0.
Fixes: #356, #1060