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

[BUG] VM watchdog device emulation breaks terraform action #77

Open
pkonotopov opened this issue Feb 18, 2021 · 2 comments
Open

[BUG] VM watchdog device emulation breaks terraform action #77

pkonotopov opened this issue Feb 18, 2021 · 2 comments
Labels

Comments

@pkonotopov
Copy link

pkonotopov commented Feb 18, 2021

Describe the bug

During the creating VM from template which contain hardware watchdog emulation device we have got an errors.

To Reproduce
Steps to reproduce the behavior:

  1. Pick any VM template and add to it the hardware watchdog emulation (see the Proxmox API docs about this - https://pve.proxmox.com/pve-docs/api-viewer/#/nodes/{node}/qemu/{vmid}/config, the last string in this doc):
curl --insecure  \
--cookie "$proxmox_cookie" \
--header "$proxmox_token" \
-X POST $proxmox_url/nodes/$proxmox_host/qemu/$vm_template_id/config \
--data-urlencode watchdog="model=i6300esb,action=reset"
  1. Create terraform file, smth like this:
resource "proxmox_virtual_environment_vm" "ubuntu-2004" {
  description = "Managed by Terraform"
  count       = 1

  agent {
    enabled = true
  }

  disk {
    datastore_id = var.disk_type.datastore_name
    file_format  = var.disk_type.file_format
    size         = var.disk_type.size
    interface    = var.disk_type.interface
  }

  clone {
    node_name = var.template_source_vm.vm_host
    vm_id     = var.template_source_vm.vm_id
  }
  cpu {
    cores   = 1
    sockets = 1
  }
  memory {
    dedicated = 1024
  }
  initialization {
    datastore_id = var.disk_type.datastore_name
    ip_config {
      ipv4 {
        address = "dhcp"
      }
    }
    user_account { }
  }
  name = (element(var.instance_tags, count.index))
  network_device {}
  node_name = var.template_source_vm.vm_host

  operating_system {
    type = "l26"
  }
  serial_device {
  }
  template = false
}
  1. terraform plan
  2. See the error:
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

proxmox_virtual_environment_vm.ubuntu-2004[0]: Refreshing state... [id=220]

Error: Failed to decode HTTP GET response (path: nodes/hyper-0/qemu/220/config)

Reason: 
json: cannot unmarshal string into Go struct field 
VirtualEnvironmentVMGetResponseData.data.watchdog 
of type proxmox.CustomWatchdogDevice
@pkonotopov pkonotopov changed the title [BUG] Watchdog device breakes tf action [BUG] Watchdog device breaks terraform action Feb 18, 2021
@pkonotopov pkonotopov changed the title [BUG] Watchdog device breaks terraform action [BUG] VM watchdog device emulation breaks terraform action Feb 18, 2021
@danitso-dp
Copy link
Collaborator

@pkonotopov I've created a fix in #78 which will be released as v0.4.4. I'm also adding a watchdog argument as a new feature in v0.5.0.

@pkonotopov
Copy link
Author

@pkonotopov I've created a fix in #78 which will be released as v0.4.4. I'm also adding a watchdog argument as a new feature in v0.5.0.

Great, thanks!

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

No branches or pull requests

2 participants