Telmate / terraform-provider-proxmox

Terraform provider plugin for proxmox
MIT License
2.21k stars 533 forks source link

Incorrect `cpuType` Value Handling for Nehalem in Proxmox-api-go? #1133

Closed partizanes closed 1 month ago

partizanes commented 1 month ago

Description: The problem is related to the CPU type Nehalem, which is either incorrectly handled or missing in the Proxmox API.

Details:

  1. When trying to specify Nehalem (the correct CPU name) in a Proxmox VM configuration via the Proxmox API, the following error occurs:

    Error: cpuType can only be one of the following values: '486, Broadwell, Cascadelake-Server, Conroe, EPYC, Haswell, Icelake-Server, IvyBridge, KnightsMill, Nahalem, Nahalem-IRBS, ...'

    This happens because Nehalem is not listed as a valid option in the proxmox-api-go https://github.com/Telmate/proxmox-api-go/blob/b149708f750b75dbb4e332322d7cdba6fc4c0c38/proxmox/config_qemu_cpu.go#L290

  2. When trying to use Nahalem (which is an incorrect spelling but listed in the API), the following error is returned by Proxmox 7.4:

    error: error updating VM: 400 Parameter verification failed., error status: {"data":null,"errors":{"cpu":"invalid format - Built-in cputype 'Nahalem' is not defined"}}

Steps to Reproduce:

  1. Define a Proxmox VM using the API with the following configuration:
    resource "proxmox_vm_qemu" "example" {
     ...
     cpuType = "Nehalem" # Correct CPU type name
     ...
    }
  2. Run the configuration and observe the error related to valid CPU types.
  3. Alternatively, try using Nahalem, which leads to an error from Proxmox 7.4 due to the API not recognizing it as a valid CPU type.

Expected Behavior: The Proxmox API should correctly handle Nehalem as a valid CPU type, consistent with the actual CPU architecture used in Proxmox and QEMU/KVM environments.

Actual Behavior: The API incorrectly lists Nahalem, which leads to an error when applied to Proxmox 7.4, as the hypervisor does not recognize this CPU type.

Suggested Fix: The Proxmox API should be updated to include Nehalem as a valid CPU type in its configuration, removing the incorrect Nahalem listing. The API should provide correct CPU types to the provider.