Telmate / terraform-provider-proxmox

Terraform provider plugin for proxmox
MIT License
2.11k stars 511 forks source link

clones or updates error when run terraform apply #154

Closed cabrizio closed 1 year ago

cabrizio commented 4 years ago

Hi, I am having this issue when I run 'terraform apply'


proxmox_vm_qemu.cloudinit-test: Creating...

Error: Cloud-init parameters only supported on clones or updates

  on main.tf line 9, in resource "proxmox_vm_qemu" "cloudinit-test":
   9: resource "proxmox_vm_qemu" "cloudinit-test" {

this is my configuration

resource "proxmox_vm_qemu" "cloudinit-test" {
    name = "terraform-test-vm"
    target_node = "dev2"

    pool = "DEV-TOOLS"
    #clone = "Centos-Template"
    iso = "local:terraform-ubuntu-14.04.5-server-amd64.iso"
    # Activate QEMU agent for this VM
    #agent = 1

    os_type = "cloud-init"
    cores = "2"
    sockets = "1"
    vcpus = "0"
    cpu = "host"
    memory = "2048"
    scsihw = "lsi"

    disk {
        id = 0
        size = 16
        type = "scsi"
        storage = "local-lvm"
        storage_type = "rbd"
        iothread = true
    }

    network {
        id = 0
        model = "rtl8139"
        bridge = "vmbr1"
    }
    ipconfig0 = "ip=192.168.40.201/24,gw=192.168.40.1"
}

Any idea? am I missing something? Thanks!

joeryan commented 4 years ago

I think you need to clone a cloudinit ready template in your main.tf. I notice you have the 'clone' line commented out. However, I'm also unable to get a terraform apply to succeed against proxmox. I am running proxmox 6.x and I think the API to clone expects a vmid, while terraform proxmox provider is passing a vm name.

Error recieved:

proxmox_vm_qemu.terraform_test[0]: Creating...

Error: Vm 'ubuntu-1804-cloudinit' not found

  on main.tf line 1, in resource "proxmox_vm_qemu" "terraform_test":
   1: resource "proxmox_vm_qemu" "terraform_test" {

main.tf

resource "proxmox_vm_qemu" "terraform_test" {
  count             = 1
  name              = "kubernetes-master-${count.index}"
  target_node       = "pmx23"

  clone             = "ubuntu-1804-cloudinit"

  os_type           = "cloud-init"
  cores             = 4
  sockets           = "1"
  cpu               = "host"
  memory            = 1024
  scsihw            = "virtio-scsi-pci"
  bootdisk          = "scsi0"

  network {
    id              = 0
    model           = "virtio"
    bridge          = "vmbr0"
  }

  lifecycle {
    ignore_changes  = [
      network,
    ]
  }

  # Cloud Init Settings
  ipconfig0         = "ip=192.168.11.21${count.index + 1}/24,gw=192.168.11.1"

  sshkeys = <<EOF
  ${var.ssh_key}
  EOF
}

Output when accessing the proxmox API from the CLI

root@pmx23:~# pvesh get /nodes/pmx23/qemu
status  │ vmid │ cpus │ lock │   maxdisk │   maxmem │ name                  │  pid │ qmpstatus │ tags │     
│ stopped │ 9003 │    1 │      │  2.20 GiB │ 2.00 GiB │ ubuntu-1804-cloudinit │      │           │      │     
prologic commented 3 years ago

I'm running into this as well. We shouldn't have to clone a VM template for this to work.

I expect a Cloudinit drive resource to be constructed in Proxmox and attached to the VM before it is booted.

Can we do this?

glitchcrab commented 3 years ago

I also think i'm running into the same issue - I want to clone an existing template and boot it (with a CI drive attached). I'm getting the same error:

Error: Vm 'ubuntu-2004-base-image' not found
jgao1025 commented 2 years ago

I got the same issue, but I fix this by opening more permission on the user.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 60 days with no activity. Please update the provider to the latest version and, in the issue persist, provide full configuration and debug logs

github-actions[bot] commented 1 year ago

This issue was closed because it has been inactive for 5 days since being marked as stale.

pich4ya commented 2 months ago

Can the proxmox provider create a new VM without clone or update?

Tinyblargon commented 2 months ago

@pich4ya, it should be possible, but then the vm doesn't have an os. Never tried it.