Open ddelnano opened 2 years ago
This means the power_state property is not being refreshed properly.
I have done some testing on this:
When changing the power_state
property from Computed: true,
to
Optional: true,
Default: "Running",
Terraform detects that it has changed:
# xenorchestra_vm.vm will be updated in-place
~ resource "xenorchestra_vm" "vm" {
id = "1daf4d69-58e3-1976-b7c4-7e6edb0ee595"
~ power_state = "Halted" -> "Running"
tags = [
"dev",
]
# (16 unchanged attributes hidden)
~ disk {
~ attached = false -> true
# (6 unchanged attributes hidden)
}
~ network {
~ attached = false -> true
# (5 unchanged attributes hidden)
}
# (1 unchanged block hidden)
}
applying this, terraform fails with:
╷
│ Error: jsonrpc2: code 13 message: VM state is halted but should be running: {"objectId":"1daf4d69-58e3-1976-b7c4-7e6edb0ee595","expected":"running","actual":"halted"}
│
│ with xenorchestra_vm.vm,
│ on main.tf line 1, in resource "xenorchestra_vm" "vm":
│ 1: resource "xenorchestra_vm" "vm" {
│
╵
When investigating #196, I noticed that if a VM created with terrraform is stopped a subsequent
terraform plan
will not show that the VM will be started. This means thepower_state
property is not being refreshed properly.