Closed bufanda closed 1 year ago
Hi @bufanda, thanks for reporting this issue.
It is definitely possible for terraform to handle this case properly. At the moment, I don't know if this is additional fallout from the XO api preventing empty string params (#231) or if the changes to address that caused a new bug. In any case, the provider should be able to handle this.
I'm currently traveling through April 23rd, but I'm hoping to have time to address this. In the meantime, I would use terraform's ignore_changes meta argument and remove the affinity host from the UI (note the code below is an example and was not tested):
resource "xenorchestra_vm" "vm_name" {
[ .. ]
lifecycle {
ignore_changes = [affinity_host],
}
}
That should allow you to continue using the provider to manage these resources until the bug is fixed.
Hi,
the ignore_changes works for now. Thanks.
I found a workaround to remove affinity. Simply set the affinity_host
the pool id. This makes the affinity None
in Xen Orchestra.
affinity_host = data.xenorchestra_pool.pool.id
I found a workaround to remove affinity. Simply set the
affinity_host
the pool id. This makes the affinityNone
in Xen Orchestra.affinity_host = data.xenorchestra_pool.pool.id
Tried it. When you have a VM stopped it won't start anymore as the affinity host wiht the pool id doesn't exists.
You'll get an error message like this
You gave an invalid object reference. The object may have recently been deleted. The class parameter gives the type of reference given, and the handle parameter echoes the bad value given.
class: host
handle: b0b45af2-b561-5cc7-fc28-0a65b3aa32e0
@bufanda yeah, you're right. I should've tested that more than just checking if the host was removed.
I have a VM I had configured an affinity host, now with an expanded cluster and reworking some of the VM distribution I want this one particular VM to not have a affinity to one particular host anymore. So I removed the affinity host rule from the terraform file but now I get the following error.
As the affinity host rule os only optional per documentation shouldn't it be possible to remove the rule and have terraform remove the setting from the host? Or do I have to destroy the VM and recreate it. Which sure would be possible but it isn't the behaviour I would expect. As in the gui I can simply click on the 'X' to remove the affinity.