khanh-ph/proxmox-kubernetes

Error: 400 Parameter verification failed 12: resource "proxmox_vm_qemu" "ubuntu_vm"

cleitonpena opened this issue · 16 comments

Hello @khanh-ph
Everything is OK after the terraform plan. When I run terraform apply, it returns this error:

Error: 400 Parameter verification failed. │ │ with module.k8s_worker_nodes.proxmox_vm_qemu.ubuntu_vm[2], │ on modules/proxmox_ubuntu_vm/main.tf line 12, in resource "proxmox_vm_qemu" "ubuntu_vm": │ 12: resource "proxmox_vm_qemu" "ubuntu_vm" {

Line 12 of main.tf is:

resource "proxmox_vm_qemu" "ubuntu_vm" {

What could be happening?
What do you suggest to correct this error?
Thank you for your blog. Congratulations.

Hi @cleitonpena,
Could you share your plan output?

Thank you for answering me so quickly.
Here is the output of the terraform plan.
All the best, @khanh-ph

plan-to-KHANH-PH.txt

Hello, @khanh-ph
I don't know if it helps to clarify, but follows the return of terraform apply
Thank you.

output-apply-to-KHANH-PH.txt

@cleitonpena Upon inspecting your outputs, I didn't find anything abnormal except for the target_host expecting the hostname of your Proxmox VE node rather than an IP address. Could you update the pm_host variable and give it a try?

Hello, @khanh-ph
You were right. Thank you for your patience and attention.
I corrected the hostname and managed to overcome that problem.
However, now another complication has occurred:

Error: Plugin did not respond │ │ with module.k8s_worker_nodes.proxmox_vm_qemu.ubuntu_vm[2], │ on modules/proxmox_ubuntu_vm/main.tf line 12, in resource "proxmox_vm_qemu" "ubuntu_vm": │ 12: resource "proxmox_vm_qemu" "ubuntu_vm" { │ │ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details.

Please find attached the return of terraform apply.
Thank you very much for continuing to help me in this phase.
Thank You Very Much.

terra-aply-to-KHANH-PV.txt

Me here again, @khanh-ph
I activated the logs and follow the log file, in case you need to evaluate something more thoroughly.
Thank you.

terraform-plugin-proxmox.log

@cleitonpena
I feel that it might not be possible to provision VMs simultaneously. Could you try setting the system environment var TF_CLI_ARGS_apply on your desktop machine before running terraform apply?

export TF_CLI_ARGS_apply="-parallelism=1"

Thank you, once again, @khanh-ph
I tried according to your last instruction, but I return the same error.
Researching this type of problem, I saw in a post that this error
Can be corrected if you change pm_tls_insecure from true to "false".
I did that and Terraform asked for a certificate.
I generated an x509-based certificate on my Vscode/localhost and loaded on Proxmox.
I don't think that was enough because Terraform wants it to be a known authority. And for testing and DEV,
I don't see the need to generate a certificate, via Let's Encrypt, for example.
However, I don't know if changing the certificate will actually solve this last error, because I haven't tested it yet,
And I know if it will work out.
This error:
Planning failed. Terraform encountered an error while generating this plan. │ Error: Get "https://pve6:8006/api2/json/access/users?full=1": x509: certificate signed by unknown authority │ with provider["registry.terraform.io/telmate/proxmox"], │ on providers.tf line 16, in provider "proxmox": │ 16: provider "proxmox" {

Please, what do you suggest?

Thank you, once again.

@cleitonpena When it's for testing and dev purposes, setting pm_tls_insecure to true is more relevant. Please revert that variable value. May I know which Terraform client version you are using?

terraform version

Hi @khanh-ph
thank you.

Terraform v1.6.6
on darwin_arm64

  • provider registry.terraform.io/hashicorp/null v3.2.1
  • provider registry.terraform.io/telmate/proxmox v2.9.14

Yes, I'll change tls_insecure to true, but I managed to generate a certificate that Terraform recognized as valid. This is solved.

Thanks

@cleitonpena
It doesn't appear to be a compatibility issue with that Terraform version. I haven't been able to replicate the issue using Terraform 1.6.6.

Are you using Proxmox VE 8.1.x? I came across the following thread that might relate to your situation: Link to the thread. It seems that the plugin used in my project doesn't support the latest Proxmox VE version, 8.1.x. I have several environments running Proxmox 7.3 and 8.0.3 and they are functioning properly. I would suggest trying with these versions if feasible.

I'll dedicate my time to devising a solution that makes this project compatible with the most recent Proxmox VE version.

Hi @khanh-ph
But this option did not solve the problem. Both true and false, in the same way, when running Terraform Apply, the error is this:

Error: 400 Parameter verification failed. with module.k8s_worker_nodes.proxmox_vm_qemu.ubuntu_vm[2], on modules/proxmox_ubuntu_vm/main.tf line 12, in resource "proxmox_vm_qemu" "ubuntu_vm": 12: resource "proxmox_vm_qemu" "ubuntu_vm" {

It may be that I did something wrong, and that's why I'm sending the files for your analysis, if you can continue to help me.
Thank you for your collaboration

example.txt
providers.txt
terraform-plugin-proxmox.log
variables.txt
return-apply.txt

@cleitonpena Please find my last message as below. Remember to update pm_host in your example.tfvars file to fix the 400 error.

@cleitonpena It doesn't appear to be a compatibility issue with that Terraform version. I haven't been able to replicate the issue using Terraform 1.6.6.

Are you using Proxmox VE 8.1.x? I came across the following thread that might relate to your situation: Link to the thread. It seems that the plugin used in my project doesn't support the latest Proxmox VE version, 8.1.x. I have several environments running Proxmox 7.3 and 8.0.3 and they are functioning properly. I would suggest trying with these versions if feasible.

I'll dedicate my time to devising a solution that makes this project compatible with the most recent Proxmox VE version.

Yes, @khanh-ph
I'm using 8.1.3
pve-manager/8.1.3/b46aac3b42da5d15 (running kernel: 6.5.11-4-pve)
I'm trying to run your orders.
Thanks.

In fact, @khanh-ph
You are always right: after correcting pm_host, it ran normally. But then, after creating all the VMs and being well advanced, I entered the thread you mentioned, with this error message:

` Error: Request cancelled
with module.k8s_worker_nodes.proxmox_vm_qemu.ubuntu_vm[2],
on modules/proxmox_ubuntu_vm/main.tf line 12, in resource "proxmox_vm_qemu" "ubuntu_vm":
12: resource "proxmox_vm_qemu" "ubuntu_vm" {

The plugin.(*GRPCProvider).ApplyResourceChange request was cancelled.

Stack trace from the terraform-provider-proxmox_v2.9.14 plugin:
panic: interface conversion: interface {} is string, not float64
goroutine 107 [running]:
github.com/Telmate/proxmox-api-go/proxmox.NewConfigQemuFromApi(0x140003626e0, 0x1027f2ab6?)
github.com/Telmate/proxmox-api-go@v0.0.0-20230319185744-e7cde7198cdf/proxmox/config_qemu.go:584 +0x3b34
github.com/Telmate/terraform-provider-proxmox/proxmox.resourceVmQemuCreate(0x140000aad80, {0x10296dee0?, 0x14000194230})
github.com/Telmate/terraform-provider-proxmox/proxmox/resource_vm_qemu.go:972 +0x21cc
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0x102aaa9a0?, {0x102aaa9a0?, 0x1400046b440?}, 0xd?, {0x10296dee0?, 0x14000194230?})
github.com/hashicorp/terraform-plugin-sdk/v2@v2.25.0/helper/schema/resource.go:695 +0x134
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0x140003c67e0, {0x102aaa9a0, 0x1400046b440}, 0x14000338340, 0x140000aac00, {0x10296dee0, 0x14000194230})
github.com/hashicorp/terraform-plugin-sdk/v2@v2.25.0/helper/schema/resource.go:837 +0x86c
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0x14000450b58, {0x102aaa9a0?, 0x1400046b2c0?}, 0x140006282d0)
github.com/hashicorp/terraform-plugin-sdk/v2@v2.25.0/helper/schema/grpc_provider.go:1021 +0xb70
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0x140000b43c0, {0x102aaa9a0?, 0x140004f2ba0?}, 0x14000152460)
github.com/hashicorp/terraform-plugin-go@v0.14.3/tfprotov5/tf5server/server.go:818 +0x3b8
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x102a73a60?, 0x140000b43c0}, {0x102aaa9a0, 0x140004f2ba0}, 0x140001523f0, 0x0)
github.com/hashicorp/terraform-plugin-go@v0.14.3/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:385 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0x14000468000, {0x102aae540, 0x1400015cea0}, 0x140006a05a0, 0x1400046ab40, 0x102f4b860, 0x0)
google.golang.org/grpc@v1.53.0/server.go:1336 +0xb7c
google.golang.org/grpc.(*Server).handleStream(0x14000468000, {0x102aae540, 0x1400015cea0}, 0x140006a05a0, 0x0)
google.golang.org/grpc@v1.53.0/server.go:1704 +0x82c
google.golang.org/grpc.(*Server).serveStreams.func1.2()
google.golang.org/grpc@v1.53.0/server.go:965 +0x84
created by google.golang.org/grpc.(*Server).serveStreams.func1
google.golang.org/grpc@v1.53.0/server.go:963 +0x290
Error: The terraform-provider-proxmox_v2.9.14 plugin crashed!
This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.`

@cleitonpena Thanks for your inputs. I am closing this thread since the primary issue, '400 Parameter verification failed,' has been resolved by correcting the pm_host variable. Let's move the other one to a separate thread at issue #92 to avoid confusion.