Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support configuring viommu #1749

Open
hillsp opened this issue Feb 7, 2025 · 4 comments
Open

Support configuring viommu #1749

hillsp opened this issue Feb 7, 2025 · 4 comments
Labels
👶 good first issue Good for newcomers size/S ✨ enhancement New feature or request

Comments

@hillsp
Copy link

hillsp commented Feb 7, 2025

I am trying to create a proxmox_virtual_environment_vm that uses a virtio viommu. I cannot find a way to do this.

Using qm the IOMMU is selected by adding ,viommu=virtio to the machine type:

https://pve.proxmox.com/wiki/PCI(e)_Passthrough#qm_pci_viommu
https://pve.proxmox.com/pve-docs/pve-admin-guide.html#qm_pci_viommu

If I set my machine type to q35,viommu=virtio, the machine type fails validation:

│ Error: invalid value for machine (must be a valid machine type)
│ 
│   with proxmox_virtual_environment_vm.vm,
│   on main.tf line 20, in resource "proxmox_virtual_environment_vm" "vm":
│   20:   machine = "q35,viommu=virtio"

I cannot find a way to configure viommu using the provider, even after searching the source code.

I would like the ability to select a viommu. Either via the machine attribute or a separate attribute would work for me.

@hillsp hillsp added the ✨ enhancement New feature or request label Feb 7, 2025
@bpg bpg moved this from 📥 Inbox to ☑️ Todo in terraform-provider-proxmox Feb 9, 2025
@bpg bpg added the size/S label Feb 9, 2025
@nakamorichi
Copy link

I guess need to at least fix the validation:

r := regexp.MustCompile(`^$|^(pc|pc(-i440fx)?-\d+(\.\d+)+(\+pve\d+)?(\.pxe)?|q35|pc-q35-\d+(\.\d+)+(\+pve\d+)?(\.pxe)?|virt(?:-\d+(\.\d+)+)?(\+pve\d+)?)$`)

@bpg
Copy link
Owner

bpg commented Feb 24, 2025

Hey @nakamorichi 👋🏼

Would you be open to creating a PR to implement that? :)

I don't think adding an extra viommu (or similar) attribute makes sense here, as it would require combining two independent config values into one API field, which is not recommended.

In an ideal world, I would have:

machine { 
  type   = "q35"
  viommu = "virtio"
}

But that would be a breaking change for almost everyone. So perhaps we can consider this for #1231.

@bpg bpg added the 👶 good first issue Good for newcomers label Feb 24, 2025
@nakamorichi
Copy link

nakamorichi commented Feb 25, 2025

I confirmed on my local Mac, just fixing the validation seems to be enough.

@bpg Separating viommu to independent config value seems to be better approach indeed.

Regarding the plugin framework, I'm not sure I have enough spare time currently to take deeper look into it. In case we don't want to add new config value, would it be ok to at least modify the validation so that people can at least get the setting work? No need to even change documentation, but just loosen the validation so that those who need are able to pass the setting without being blocked by the validation?

Btw, unrelated issue; I would like this to also be fixed: https://registry.terraform.io/providers/bpg/proxmox/latest/docs/resources/virtual_environment_file#source_raw-1 (currently source_raw argument doesn't work properly).

@bpg
Copy link
Owner

bpg commented Feb 26, 2025

... would it be ok to at least modify the validation so that people can at least get the setting work?

Yeah, that's what I'm inclining to. Don't stress much, feel free to open a PR, and we can collaborate to move it over the finish line :)

Btw, unrelated issue; I would like this to also be fixed: https://registry.terraform.io/providers/bpg/proxmox/latest/docs/resources/virtual_environment_file#source_raw-1 (currently source_raw argument doesn't work properly).

Not sure what do you mean by "doesn't work properly"? Would you mind opening a new ticket to provide more details?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
👶 good first issue Good for newcomers size/S ✨ enhancement New feature or request
Projects
Status: ☑️ Todo
Development

No branches or pull requests

3 participants