Page MenuHomeSoftware Heritage

terraform: upgrade proxmox provider to last release
Closed, MigratedEdits Locked

Description

The proxmox provider is now "supported" and regularly released. [1]

We should upgrade our configuration to migrate to the last version

a quick test show there will be some adaptation to do:

~/src/swh/swh-sysadmin-provisioning/proxmox/terraform/staging master* ❯ terraform plan                                                                                                                                     18:22:32
╷
│ Error: Unsupported argument
│ 
│   on ../modules/node/main.tf line 60, in resource "proxmox_vm_qemu" "node":
│   60:       id           = disk.value["id"]
│ 
│ An argument named "id" is not expected here. Did you mean "ssd"?
....

[1] https://registry.terraform.io/providers/Telmate/proxmox/latest/docs

Event Timeline

vsellier changed the task status from Open to Work in Progress.Dec 14 2021, 6:28 PM
vsellier triaged this task as Normal priority.
vsellier created this task.

After some adapations, the syntax is now good.

One of the hardest problem to find due to the lack of context was this error when a terraform command is executed:

│ Error: number is required
│ 
│   with module.webapp1.proxmox_vm_qemu.node,
│   on ../modules/node/main.tf line 1, in resource "proxmox_vm_qemu" "node":
│    1: resource "proxmox_vm_qemu" "node" {
│

It was due to a configuration format change : https://github.com/Telmate/terraform-provider-proxmox/commit/facf1c0432f4a8b5e553544e8f9d16e9c7687426

The boolean values need to be converted to int
This sed do the job:

sed  -i -e 's/"backup": false/"backup": 0/' -e 's/"iothread": false/"iothread": 0/' -e 's/"replicate": false/"replicate": 0/' -e 's/"ssd": false/"ssd": 0/' terraform.tfstate

The states can now be updated to avoid any change detection:

# module.worker18.proxmox_vm_qemu.node will be updated in-place
~ resource "proxmox_vm_qemu" "node" {
    + additional_wait           = 0
    ~ clone_wait                = 15 -> 0
    + guest_agent_ready_timeout = 100
      id                        = "uffizi/qemu/141"
      name                      = "worker18"
    + oncreate                  = true
      # (37 unchanged attributes hidden)


      # (2 unchanged blocks hidden)
  }

proxmox provider updated to v2.9.3