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

error creating clonr vm linked clone #1342

Open
finn0000 opened this issue May 30, 2024 · 4 comments
Open

error creating clonr vm linked clone #1342

finn0000 opened this issue May 30, 2024 · 4 comments
Labels
🐛 bug Something isn't working ⌛ pending author's response Requested additional information from the reporter

Comments

@finn0000
Copy link

finn0000 commented May 30, 2024

Describe the bug
My main.tf

terraform {
  required_providers {
    proxmox = {
      source  = "bpg/proxmox"
      version = "0.57.0"
    }
  }
}

provider "proxmox" {
    endpoint = 
    api_token = 
    insecure = true
}

resource "proxmox_virtual_environment_vm" "worker_node" {
  count     = "1"
  name      = "testtr"
  node_name = "pve"
  clone {
    full = "false"
    vm_id = 10000
  }
  stop_on_destroy = true
}
terraform apply
data.proxmox_virtual_environment_nodes.example: Reading...
data.proxmox_virtual_environment_nodes.example: Read complete after 0s [id=nodes]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # proxmox_virtual_environment_vm.example will be created
  + resource "proxmox_virtual_environment_vm" "example" {
      + acpi                    = true
      + bios                    = "seabios"
      + id                      = (known after apply)
      + ipv4_addresses          = (known after apply)
      + ipv6_addresses          = (known after apply)
      + keyboard_layout         = "en-us"
      + mac_addresses           = (known after apply)
      + migrate                 = false
      + name                    = "test-centos"
      + network_interface_names = (known after apply)
      + node_name               = "pve"
      + on_boot                 = true
      + protection              = false
      + reboot                  = false
      + scsi_hardware           = "virtio-scsi-pci"
      + started                 = true
      + stop_on_destroy         = false
      + tablet_device           = true
      + template                = false
      + timeout_clone           = 1800
      + timeout_create          = 1800
      + timeout_migrate         = 1800
      + timeout_move_disk       = 1800
      + timeout_reboot          = 1800
      + timeout_shutdown_vm     = 1800
      + timeout_start_vm        = 1800
      + timeout_stop_vm         = 300
      + vm_id                   = (known after apply)

      + clone {
          + full    = false
          + retries = 1
          + vm_id   = 10000
        }
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

proxmox_virtual_environment_vm.example: Creating...
╷
│ Error: Plugin did not respond
│ 
│ The plugin encountered an error, and failed to respond to the plugin6.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more
│ details.
╵

Stack trace from the terraform-provider-proxmox_v0.57.0 plugin:

panic: runtime error: index out of range [1] with length 1

goroutine 10 [running]:
github.com/bpg/terraform-provider-proxmox/proxmox/nodes/vms.(*CustomUSBDevice).UnmarshalJSON(0xc000704bb8, {0xc0000fe682, 0x7, 0x57e})
        github.com/bpg/terraform-provider-proxmox/proxmox/nodes/vms/vms_types.go:1743 +0x254
encoding/json.(*decodeState).literalStore(0xc000720528, {0xc0000fe682, 0x7, 0x57e}, {0xe74780?, 0xc000709348?, 0x4?}, 0x0)
        encoding/json/decode.go:854 +0x221e
encoding/json.(*decodeState).value(0xc000720528, {0xe74780?, 0xc000709348?, 0x4?})
        encoding/json/decode.go:388 +0x115
encoding/json.(*decodeState).object(0xc000720528, {0xdeab60?, 0xc00079a3b8?, 0xc0002464b0?})
        encoding/json/decode.go:755 +0xd11
encoding/json.(*decodeState).value(0xc000720528, {0xdeab60?, 0xc00079a3b8?, 0x4?})
        encoding/json/decode.go:374 +0x3e
encoding/json.(*decodeState).object(0xc000720528, {0xdeaf20?, 0xc00079a3b8?, 0xc0000b24f0?})
        encoding/json/decode.go:755 +0xd11
encoding/json.(*decodeState).value(0xc000720528, {0xdeaf20?, 0xc00079a3b8?, 0xc0000b2540?})
        encoding/json/decode.go:374 +0x3e
encoding/json.(*decodeState).unmarshal(0xc000720528, {0xdeaf20?, 0xc00079a3b8?})
        encoding/json/decode.go:181 +0x11e
encoding/json.(*Decoder).Decode(0xc000720500, {0xdeaf20, 0xc00079a3b8})
        encoding/json/stream.go:73 +0x15a
github.com/bpg/terraform-provider-proxmox/proxmox/api.(*client).DoRequest(0xc000011578, {0x112ef30, 0xc00061c000}, {0xf8f995, 0x3}, {0xc000596580, 0x19}, {0x0?, 0x0?}, {0xdeaf20, ...})
        github.com/bpg/terraform-provider-proxmox/proxmox/api/client.go:252 +0x1171
github.com/bpg/terraform-provider-proxmox/proxmox/nodes/vms.(*Client).GetVM(0xc0007042a0, {0x112ef30, 0xc00061c000})
        github.com/bpg/terraform-provider-proxmox/proxmox/nodes/vms/vms.go:138 +0xb1
github.com/bpg/terraform-provider-proxmox/proxmoxtf/resource/vm.vmCreateClone({0x112efa0, 0xc0001e30a0}, 0xc00060d580, {0xed7340, 0xc0000f60c0})
        github.com/bpg/terraform-provider-proxmox/proxmoxtf/resource/vm/vm.go:2023 +0x20a5
github.com/bpg/terraform-provider-proxmox/proxmoxtf/resource/vm.vmCreate({0x112efa0, 0xc0001e30a0}, 0xc00060d580, {0xed7340, 0xc0000f60c0})
        github.com/bpg/terraform-provider-proxmox/proxmoxtf/resource/vm/vm.go:1515 +0x70
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0xc000325ea0, {0x112eef8, 0xc000797cb0}, 0xc00060d580, {0xed7340, 0xc0000f60c0})
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:778 +0x119
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc000325ea0, {0x112eef8, 0xc000797cb0}, 0xc000475ba0, 0xc00060d400, {0xed7340, 0xc0000f60c0})
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:909 +0xa89
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc00012bc68, {0x112eef8?, 0xc000797b30?}, 0xc00024bef0)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:1078 +0xd5c
github.com/hashicorp/terraform-plugin-mux/tf5to6server.v5tov6Server.ApplyResourceChange({{0x113a138?, 0xc00012bc68?}}, {0x112eef8, 0xc000797b30}, 0x0?)
        github.com/hashicorp/[email protected]/tf5to6server/tf5to6server.go:38 +0x54
github.com/hashicorp/terraform-plugin-mux/tf6muxserver.(*muxServer).ApplyResourceChange(0xc00033ecb0, {0x112eef8?, 0xc000797860?}, 0xc00024bea0)
        github.com/hashicorp/[email protected]/tf6muxserver/mux_server_ApplyResourceChange.go:36 +0x193
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ApplyResourceChange(0xc000332820, {0x112eef8?, 0xc000796ea0?}, 0xc0001e2a80)
        github.com/hashicorp/[email protected]/tfprotov6/tf6server/server.go:865 +0x3d0
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ApplyResourceChange_Handler({0xf61500, 0xc000332820}, {0x112eef8, 0xc000796ea0}, 0xc00060cb80, 0x0)
        github.com/hashicorp/[email protected]/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:518 +0x1a6
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0001a3200, {0x112eef8, 0xc000796e10}, {0x1135e60, 0xc0002e0180}, 0xc0002786c0, 0xc0003f32f0, 0x17b2eb8, 0x0)
        google.golang.org/[email protected]/server.go:1369 +0xdf8
google.golang.org/grpc.(*Server).handleStream(0xc0001a3200, {0x1135e60, 0xc0002e0180}, 0xc0002786c0)
        google.golang.org/[email protected]/server.go:1780 +0xe8b
google.golang.org/grpc.(*Server).serveStreams.func2.1()
        google.golang.org/[email protected]/server.go:1019 +0x8b
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 28
        google.golang.org/[email protected]/server.go:1030 +0x125

Error: The terraform-provider-proxmox_v0.57.0 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.

if you remove full = "false" It's going to be okay.

@finn0000 finn0000 added the 🐛 bug Something isn't working label May 30, 2024
@bpg
Copy link
Owner

bpg commented Jun 1, 2024

Hey @finn0000 👋🏼
It looks like your source VM has some USB device configuration that provider can't parse.
Could you attach output of pvesh get /nodes/pve/qemu/10000/config from your Proxmox host?

@bpg bpg added the ⌛ pending author's response Requested additional information from the reporter label Jun 1, 2024
@micsport13
Copy link

Ran into the same issue on my machine, albeit not the exact same issue. Not sure if this needs to be broken out into another issue but I got a similar output:

│ Error: Plugin did not respond
│
│ The plugin encountered an error, and failed to respond to the
│ plugin6.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details.
╵

Stack trace from the terraform-provider-proxmox_v0.60.0 plugin:

panic: runtime error: index out of range [0] with length 0

goroutine 85 [running]:
github.com/bpg/terraform-provider-proxmox/proxmoxtf/resource/vm.vmUpdate({0x114aee0, 0xc00064f960}, 0xc000742480, {0xeedba0, 0xc0004e3a70})
        github.com/bpg/terraform-provider-proxmox/proxmoxtf/resource/vm/vm.go:5108 +0x5765
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).update(0xc000352000, {0x114ae38, 0xc000251560}, 0xc000742480, {0xeedba0, 0xc0004e3a70})
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:840 +0x119
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc000352000, {0x114ae38, 0xc000251560}, 0xc0006df520, 0xc000742300, {0xeedba0, 0xc0004e3a70})
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:947 +0x83a
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc00012bc68, {0x114ae38?, 0xc000250600?}, 0xc0006ab900)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:1153 +0xd5c
github.com/hashicorp/terraform-plugin-mux/tf5to6server.v5tov6Server.ApplyResourceChange({{0x1156bf8?, 0xc00012bc68?}}, {0x114ae38, 0xc000250600}, 0x0?)
        github.com/hashicorp/[email protected]/tf5to6server/tf5to6server.go:38 +0x54
github.com/hashicorp/terraform-plugin-mux/tf6muxserver.(*muxServer).ApplyResourceChange(0xc000340d20, {0x114ae38?, 0xc0001c54d0?}, 0xc0006ab8b0)
        github.com/hashicorp/[email protected]/tf6muxserver/mux_server_ApplyResourceChange.go:36 +0x193
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ApplyResourceChange(0xc0003328c0, {0x114ae38?, 0xc000718120?}, 0xc00064e8c0)
        github.com/hashicorp/[email protected]/tfprotov6/tf6server/server.go:865 +0x3d0
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ApplyResourceChange_Handler({0xf78900, 0xc0003328c0}, {0x114ae38, 0xc000718120}, 0xc000743180, 0x0)
        github.com/hashicorp/[email protected]/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:518 +0x1a6
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0001a5200, {0x114ae38, 0xc0006afc20}, {0x1151e60, 0xc000002180}, 0xc0000218c0, 0xc0003f5350, 0x17dafd8, 0x0)
        google.golang.org/[email protected]/server.go:1369 +0xdf8
google.golang.org/grpc.(*Server).handleStream(0xc0001a5200, {0x1151e60, 0xc000002180}, 0xc0000218c0)
        google.golang.org/[email protected]/server.go:1780 +0xe8b
google.golang.org/grpc.(*Server).serveStreams.func2.1()
        google.golang.org/[email protected]/server.go:1019 +0x8b
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 7
        google.golang.org/[email protected]/server.go:1030 +0x125

Error: The terraform-provider-proxmox_v0.60.0 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.

Output of VM using pvesh:

┌──────────┬──────────────────────────────────────────────────────────────────┐
│ key      │ value                                                            │
╞══════════╪══════════════════════════════════════════════════════════════════╡
│ boot     │ order=scsi0;ide2;net0                                            │
├──────────┼──────────────────────────────────────────────────────────────────┤
│ cores    │ 4                                                                │
├──────────┼──────────────────────────────────────────────────────────────────┤
│ cpu      │ cputype=qemu64                                                   │
├──────────┼──────────────────────────────────────────────────────────────────┤
│ cpuunits │ 1024                                                             │
├──────────┼──────────────────────────────────────────────────────────────────┤
│ digest   │ f6399a75acda3f8808abe2c45554cb236556611f                         │
├──────────┼──────────────────────────────────────────────────────────────────┤
│ ide2     │ lvm:iso/archlinux-2023.03.01-x86_64.iso,media=cdrom,size=829772K │
├──────────┼──────────────────────────────────────────────────────────────────┤
│ keyboard │ en-us                                                            │
├──────────┼──────────────────────────────────────────────────────────────────┤
│ memory   │ 4096                                                             │
├──────────┼──────────────────────────────────────────────────────────────────┤
│ name     │ TestArch                                                         │
├──────────┼──────────────────────────────────────────────────────────────────┤
│ net0     │ virtio=3A:88:CC:4D:B3:A3,bridge=vmbr0,firewall=1                 │
├──────────┼──────────────────────────────────────────────────────────────────┤
│ numa     │ 0                                                                │
├──────────┼──────────────────────────────────────────────────────────────────┤
│ ostype   │ l26                                                              │
├──────────┼──────────────────────────────────────────────────────────────────┤
│ scsi0    │ Data_Pool:vm-102-disk-0,iothread=1,size=32G                      │
├──────────┼──────────────────────────────────────────────────────────────────┤
│ scsihw   │ virtio-scsi-single                                               │
├──────────┼──────────────────────────────────────────────────────────────────┤
│ smbios1  │ uuid=53f4ca60-6dc1-4de7-b4aa-bb9807fe6c82                        │
├──────────┼──────────────────────────────────────────────────────────────────┤
│ sockets  │ 1                                                                │
├──────────┼──────────────────────────────────────────────────────────────────┤
│ vga      │ memory=16,type=std                                               │
├──────────┼──────────────────────────────────────────────────────────────────┤
│ vmgenid  │ 60300c1a-921f-4290-8743-e6bc9d5d6856                             │
└──────────┴──────────────────────────────────────────────────────────────────┘

It happened to me when I added an ipv4 config to my VM.

@bpg
Copy link
Owner

bpg commented Jun 17, 2024

Hey @micsport13, most likely that's another unrelated issue.

It happened to me when I added an ipv4 config to my VM.

Could you create a new ticket and attach a diff between the new and old configs?

@micsport13
Copy link

micsport13 commented Jun 17, 2024

@bpg See ticket #1400 . I forgot to mention it explicitly on the ticket but the only diff between the working and non working was the added initialization block

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working ⌛ pending author's response Requested additional information from the reporter
Projects
None yet
Development

No branches or pull requests

3 participants