terraform-provider-proxmox: Duplicate disks created

I’ve had the same issues with Proxmox 8 as a lot of people (like #882 and #863), but when I build this project locally from master and use that, then both these problems are solved. However, a new problem arises. The provider is supposed to increase the size of the 2G base image disk that I have, but instead, it seems like it just detaches that disk and creates a new empty one (with the correct size). This new disk is of course not bootable, and the terraform apply command stalls.

image

Any idea if this is a known problem? It didn’t seem to me like a duplicate of any other open issues right now.

Proxmox: 8.1.3 Provider: local build of latest commit, https://github.com/Telmate/terraform-provider-proxmox/commit/a8675d3967710bab4ac08fad9dbc05eed3ae2c58

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 7
  • Comments: 52 (15 by maintainers)

Commits related to this issue

Most upvoted comments

@TheGameProfi do you plan to publish a new version in your repository including this fix?

I will try to look into it today or tomorrow.

I compiled the latest code and have been using that and it seems to have fixed this issue and #704. If you need a solution now, I’d suggest you take this route.

There are instructions for compiling from source but if you are compiling it on a Debian based machine, it’d look something like this:

git clone https://github.com/hestiahacker/terraform-provider-proxmox
cd terraform-provider-proxmox
git checkout overhaul-qemu-disks
sudo apt install -y ansible make
ansible-galaxy install gantsign.ansible-role-golang
ansible-playbook go.yml
. /etc/profile.d/golang.sh
make

At that point the new provider should be in the ./bin directory. If you aren’t compiling it on your deployment machine, copy the executable over to the deployer. You’ll need to copy the executable into a particular directory on the deployer. Here are the commands from the aforementioned installation guide:

PLUGIN_ARCH=linux_amd64
mkdir -p ~/.terraform.d/plugins/registry.example.com/telmate/proxmox/1.0.0/${PLUGIN_ARCH}
cp bin/terraform-provider-proxmox ~/.terraform.d/plugins/registry.example.com/telmate/proxmox/1.0.0/${PLUGIN_ARCH}/

That source path of the cp command will change if you are compiling on a different machine, but that should be easy enough. The last step is to tell Terraform to use this new module. That means updating your terraform to look like this:

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

That should work, but if you ever need to recompile it, terraform will complain about the checksum having changed. To deal with that you can either manually remove the offending checksum from the .terraform.lock.hcl file with a text editor, or what I personally do is just delete that lock file and regenerate it like so:

rm .terraform.lock.hcl && terraform get -update && terraform init -upgrade && terraform version

Also, do realize that this is the latest code that hasn’t even been merged into this repo yet, and a fair amount has changed. So there’s some risk of bugs causing you problems. I’d suggest you test the code in your environment and with your configuration even more than you would a new, official release. I’ve tested it in my environment, but if you’re using different features than me, you could hit some code path that has a bug that I didn’t run into.

If you are in an environment that has a low risk tolerance and you can’t test this out, I have two suggestions:

  1. Get a test environment! 😱
  2. Wait for the official release 😁

Having the same issue myself. For now, the provider seems to be unusable.

Having the same problem but with TheGameProfi/proxmox. It seems defining file and volume fixes it but you need to know the id beforehand…

  disk {
    size    = "16G"
    type    = "scsi"
    storage = "vg_nvme"
    ssd     = 1
    file    = "vm-108-disk-0"
    volume  = "vg_nvme:vm-108-disk-0"
  }

Not sure how to go around this.

@ihatethecloud I wanted to try this workound but its failing at parameter verification. I’m using zfs though, not sure is it related or not. latest version of TheGameProfi/proxmox proxmox version 8.1.4 file = “vm-137-disk-0” volume = "local-zfs:vm-137-disk-0 am i doing something wrong ?

Don’t use TheGameProfi/proxmox. Build this repo if it has not been pushed to the registry yet.

version = “3.0.1-rc1” is out from telmate provider.

new version comes with different disk schema, I had to update my disk schema in tf file, now it works. its still has some glitches regarding disk type/controller though. anway thx to everyone !

ps:if someone needs a running example with clone_ _from_template+cloudinit+lvm/zfs can ping me.

Hi! Check work RC v3.0.1-rc1 on Terraform 1.6.6 / 1.7.1 with ProxMox 8.0.4 / 8.1.3. The error is gone. Everything works well. Thanks to all!

thanks @TheGameProfi for publishing a release to terraform registry including this fix. Much appreciated!

But there is no new version on the hashicorp registry? Or is it published under some other name than Telmate?

It is published as a fork under my own name, thegameprofi/proxmox There are multiple version with unreleased changes from this repo. But also, at least the newest version, has problems mounting a cloud-init drive #901

@hestiahacker what should we do? are we have to wait until new version release?

We are also hitting this problem with proxmox 8.1.3 and provider TheGameProfi/proxmox version 2.9.15

Having the same problem but with TheGameProfi/proxmox. It seems defining file and volume fixes it but you need to know the id beforehand…

  disk {
    size    = "16G"
    type    = "scsi"
    storage = "vg_nvme"
    ssd     = 1
    file    = "vm-108-disk-0"
    volume  = "vg_nvme:vm-108-disk-0"
  }

Not sure how to go around this.

Sorry, only got now time to check it out.

Tested the newest changes and it worked, and didn’t see any Errors. Released the new fixes inside my Repo.

Thanks Hestia & mleone87 & Tinyblargon for the fix 😃