Telmate / terraform-provider-proxmox

Terraform provider plugin for proxmox
MIT License
2.21k stars 535 forks source link

Is it possible to migrate existing VM to another target node? #1031

Open maksimsamt opened 5 months ago

maksimsamt commented 5 months ago

System details:

The existing VM was successfully created by the Terraform provider, on node pve10.

There is a task to migrate a VM to another node.

I assume that target_node parameter is responsible for this.

So changing this node to another (pve10 => pve11) and doing terraform apply fails with the following result:

proxmox_vm_qemu.cloud_vm_from_packer_template: Modifying... [id=pve10/qemu/11]
2024-06-04T09:41:23.803+0300 [INFO]  Starting apply for proxmox_vm_qemu.cloud_vm_from_packer_template
2024-06-04T09:41:23.809+0300 [DEBUG] proxmox_vm_qemu.cloud_vm_from_packer_template: applying the planned Update change
2024-06-04T09:41:29.856+0300 [INFO]  provider.terraform-provider-proxmox: 2024/06/04 09:41:29 500 Configuration file 'nodes/pve11/qemu-server/11.conf' does not exist: timestamp="2024-06-04T09:41:29.855+0300"
2024-06-04T09:41:29.859+0300 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2024-06-04T09:41:29.859+0300 [ERROR] plugin.(*GRPCProvider).ApplyResourceChange: error="rpc error: code = Unavailable desc = error reading from server: EOF"
2024-06-04T09:41:29.859+0300 [DEBUG] provider: plugin process exited: path=.terraform/providers/localhost/telmate/proxmox/3.0.2/linux_amd64/terraform-provider-proxmox pid=11292 error="exit status 1"
2024-06-04T09:41:29.878+0300 [DEBUG] State storage *statemgr.Filesystem declined to persist a state snapshot
2024-06-04T09:41:29.878+0300 [ERROR] vertex "proxmox_vm_qemu.cloud_vm_from_packer_template" error: Plugin did not respond
╷
│ Error: Plugin did not respond
│ 
│   with proxmox_vm_qemu.cloud_vm_from_packer_template,
│   on main.tf line 39, in resource "proxmox_vm_qemu" "cloud_vm_from_packer_template":
│   39: resource "proxmox_vm_qemu" "cloud_vm_from_packer_template" {
│ 
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details.
╵
2024-06-04T09:41:29.887+0300 [DEBUG] provider: plugin exited

In debug log there are such errors:

...
2024/06/04 09:56:52 >>>>>>>>>> REQUEST:
GET /api2/json/cluster/ha/resources/11 HTTP/1.1
... 
2024/06/04 09:56:52 <<<<<<<<<< RESULT:
HTTP/1.1 500 no such resource 'vm:11'
...
2024/06/04 09:57:03 >>>>>>>>>> REQUEST:
GET /api2/json/nodes/pve11/qemu/11/config HTTP/1.1
...
{"data":null}
2024/06/04 09:57:06 500 Configuration file 'nodes/pve11/qemu-server/11.conf' does not exist
...
spearox commented 5 months ago

Same for me while using proxmox_vm_qemu. If I migrate from node1 to node2 manually then run the terraform its apply but the provider cannot start the migration.

baltazorbest commented 5 months ago

Same for me.

maksimsamt commented 5 months ago

@Tinyblargon, What is your thoughts on this topic?

Tinyblargon commented 5 months ago

I never used the migration feature myself. My testing environment consists of:

As of right now, I don't know if the bug is between Terraform and the PVE SDK or between the SDK and the PVE API.

I'll have to first set up a new test environment.

mateusz-spychala commented 5 months ago

Proxmox: 8.2.4 Terraform: 1.8.5 terraform-provider-proxmox v3.0.1-rc3

Also do not work.

eldengates commented 4 months ago

Same here 😩

nrukavkov commented 1 month ago

same, it is painfull

paivin-dn commented 3 weeks ago

We met the same problem: