Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

terraform plugin crashes via slow cloning or sth while cloning existing template #1083

Open
Reckoner911 opened this issue Aug 28, 2024 · 7 comments

Comments

@Reckoner911
Copy link

│ Error: Plugin did not respond

│ with proxmox_vm_qemu.first-tf-vm,
│ on main.tf line 19, in resource "proxmox_vm_qemu" "first-tf-vm":
│ 19: resource "proxmox_vm_qemu" "first-tf-vm" {

│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details.

Stack trace from the terraform-provider-proxmox_v2.9.14 plugin:

panic: interface conversion: interface {} is string, not float64

goroutine 81 [running]:
github.com/Telmate/proxmox-api-go/proxmox.NewConfigQemuFromApi(0xc000142718, 0xc9d509?)
github.com/Telmate/proxmox-api-go@v0.0.0-20230319185744-e7cde7198cdf/proxmox/config_qemu.go:584 +0x4605
github.com/Telmate/terraform-provider-proxmox/proxmox.resourceVmQemuCreate(0xc000357080, {0xb66f60?, 0xc00031c370})
github.com/Telmate/terraform-provider-proxmox/proxmox/resource_vm_qemu.go:972 +0x2c4d
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0xdd7840?, {0xdd7840?, 0xc0004d0f90?}, 0xd?, {0xb66f60?, 0xc00031c370?})
github.com/hashicorp/terraform-plugin-sdk/v2@v2.25.0/helper/schema/resource.go:695 +0x178
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc000194ee0, {0xdd7840, 0xc0004d0f90}, 0xc0000b1040, 0xc000356f00, {0xb66f60, 0xc00031c370})
github.com/hashicorp/terraform-plugin-sdk/v2@v2.25.0/helper/schema/resource.go:837 +0xa85
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc000423ed8, {0xdd7840?, 0xc0004d0e70?}, 0xc00009a410)
github.com/hashicorp/terraform-plugin-sdk/v2@v2.25.0/helper/schema/grpc_provider.go:1021 +0xe8d
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc0002d8320, {0xdd7840?, 0xc0004d0450?}, 0xc0001be230)
github.com/hashicorp/terraform-plugin-go@v0.14.3/tfprotov5/tf5server/server.go:818 +0x574
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0xc6bc20?, 0xc0002d8320}, {0xdd7840, 0xc0004d0450}, 0xc0001be070, 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(0xc00025a1e0, {0xddb420, 0xc0004824e0}, 0xc0000fa000, 0xc0004317a0, 0x128f7a0, 0x0)
google.golang.org/grpc@v1.53.0/server.go:1336 +0xd23
google.golang.org/grpc.(*Server).handleStream(0xc00025a1e0, {0xddb420, 0xc0004824e0}, 0xc0000fa000, 0x0)
google.golang.org/grpc@v1.53.0/server.go:1704 +0xa2f
google.golang.org/grpc.(*Server).serveStreams.func1.2()
google.golang.org/grpc@v1.53.0/server.go:965 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
google.golang.org/grpc@v1.53.0/server.go:963 +0x28a

@Reckoner911
Copy link
Author

main.tf:

terraform {
required_providers {
proxmox = {
source = "telmate/proxmox"
version = ">=1.0.0"
}
}
required_version = ">= 0.14"
}

provider "proxmox" {
pm_api_url = " "
pm_user = " "
pm_api_token_id = " "
pm_api_token_secret = " "
pm_tls_insecure = true
}

resource "proxmox_vm_qemu" "first-tf-vm" {
name = "second-tf-vm"
target_node = "virt"
clone = "174-templ"
storage = "vm_stor"
cores = 2
memory = 2048
}

@Reckoner911 Reckoner911 closed this as not planned Won't fix, can't repro, duplicate, stale Aug 28, 2024
@Reckoner911 Reckoner911 reopened this Aug 28, 2024
@WadDyORedDy
Copy link

Hi Reckon911, did you ever find a solution for this issue? :-)

@Reckoner911
Copy link
Author

Reckoner911 commented Aug 28, 2024

@WadDyORedDy , no, I'm newbie in tf, and I don't find any solution for this
Is it my bad? Can you help me?

@Reckoner911
Copy link
Author

I don't understand why the plugin doesn't respond and I don't understand how it works under the hood. Usually I just get an error at the terraform plan stage, but here with terraform apply. The VM deployed

@WadDyORedDy
Copy link

@Reckoner911 - I just checked issue 1074 and there is a solution.

Update your provider to use the latest version. You might need to fiddle a little with the proxmox_vm_qemu resource.

I'm still trying some stuff, and I'm stuck in a pxeboot-loop on the VM, but it's created and works with the newest version. Remember to use "terraform init -upgrade" when using a new version :-) I'll keep you updated if I get it to work - right now it seems like my network-block needs some looking into.

@Reckoner911
Copy link
Author

@WadDyORedDy
Thanks so much, I'll gonna try do this in while workday

@WadDyORedDy
Copy link

WadDyORedDy commented Aug 28, 2024

@Reckoner911 - I got it to work.

First of all, I'm using version 3.0.1-rc3.

My main.tf looks like this:

resource "proxmox_vm_qemu" "debian-template" {
    name = "terraform-vm-1"
    desc = "Terraform created VM from debian-template"
    vmid = "UNIQUE ID"
    target_node = "node03"

    agent = 0
    bootdisk = "scsi0"
    clone = "debian-template"
    cores = 1
    sockets = 1
    cpu = "host"
    memory = "2048"

    disks {
      scsi {
        scsi0 {
          disk {
            size = "32G"
            storage = "local-lvm"
          }
        }
      }
    }
}

I'm also using a provider.tf and credentials.auto.tfvars.

I've used issue #977 and #1074 as references. Also a fair bit of searching for specific issues - but now it works :-)

It seems like the disks {} block and bootdisk had some syntax-errors on my last couple of tries, and it would result in a PXE-boot loop (no PXE-boot on my side). But this works as intended and boots correctly from the scsi0-disk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants