terraform-provider-proxmox
terraform-provider-proxmox copied to clipboard
PVE API error `HTTP 599 response - Reason: Too many redirections`
Describe the bug
When vm creation fails - the error I got to complete: error retrieving task status: received an HTTP 599 response - Reason: Too many redirections
, re-plan and re-apply fails to apply the replace in the sate for virtual_machine. VM is already created on first try but vm stuck at stopped status. However, the tf provider wasn't able to recover it from that state. I am already using GCS to store the state so that way I am generating the plan where I left off.
# module.test[0].module.workers[1].proxmox_virtual_environment_vm.virtual_machine is tainted, so it must be replaced
+/- resource "proxmox_virtual_environment_vm" "virtual_machine" {
~ id = "2005" -> (known after apply)
~ ipv4_addresses = [] -> (known after apply)
~ ipv6_addresses = [] -> (known after apply)
~ mac_addresses = [
- "BC:24:11:FE:2C:1B",
] -> (known after apply)
name = "k8s-worker-2-test"
~ network_interface_names = [] -> (known after apply)
~ started = false -> true
tags = [
"terraform",
"worker",
]
# (22 unchanged attributes hidden)
~ cpu {
- flags = [] -> null
# (8 unchanged attributes hidden)
}
~ disk {
~ path_in_datastore = "vm-2005-disk-5" -> (known after apply)
# (12 unchanged attributes hidden)
}
~ disk {
~ path_in_datastore = "vm-2005-disk-0" -> (known after apply)
# (11 unchanged attributes hidden)
}
~ disk {
~ path_in_datastore = "vm-2005-disk-1" -> (known after apply)
# (11 unchanged attributes hidden)
}
~ disk {
~ path_in_datastore = "vm-2005-disk-2" -> (known after apply)
# (11 unchanged attributes hidden)
}
~ disk {
~ path_in_datastore = "vm-2005-disk-3" -> (known after apply)
# (11 unchanged attributes hidden)
}
~ disk {
~ path_in_datastore = "vm-2005-disk-4" -> (known after apply)
# (11 unchanged attributes hidden)
}
~ initialization {
- interface = "ide2" -> null
~ upgrade = false -> (known after apply)
# (2 unchanged attributes hidden)
# (2 unchanged blocks hidden)
}
~ network_device {
- disconnected = false -> null
~ mac_address = "BC:24:11:FE:2C:1B" -> (known after apply)
# (8 unchanged attributes hidden)
}
# (4 unchanged blocks hidden)
}
Plan: 8 to add, 0 to change, 1 to destroy.
11512e5d15c9:/project/test# tofu apply tofu.tfplan
Acquiring state lock. This may take a few moments...
module.test[0].module.workers[1].proxmox_virtual_environment_vm.virtual_machine: Creating...
╷
│ Error: error creating VM: received an HTTP 500 response - Reason: unable to create VM 2005 - VM 2005 already exists on node 'xxx'
│
│ with module.test[0].module.workers[1].proxmox_virtual_environment_vm.virtual_machine,
│ on .terraform/modules/test/modules/vm/main.tf line 1, in resource "proxmox_virtual_environment_vm" "virtual_machine":
│ 1: resource "proxmox_virtual_environment_vm" "virtual_machine" {
│
To Reproduce Steps to reproduce the behavior:
- Create a VM with terraform/tofu
- See failure creation the VM due to any reason during creating and let the tofu to store the state
- Plan again
- See the replace in the VM resource
- Run Apply
- See error
Expected behavior Expected to see that it recovers the VM from its latest state.
- Single or clustered Proxmox: Single
- Proxmox version: 8.2.2
- Provider version (ideally it should be the latest version): v0.60.0
- Terraform/OpenTofu version: OpenTofu v1.7.2
- OS (where you run Terraform/OpenTofu from): Alpine Linux v3.18
- Debug logs (
TF_LOG=DEBUG terraform apply
): apply.log