Open alexs77 opened 1 year ago
I was having a similar issue and looked into this. The default socket URI is hard-coded. Initially, I started working on a patch by adding a new field to schema.Provider in libvirt/provider.go and then modifying libvirt/uri/unix.go to pick up that field if defined. That should work as a viable way to allow the default socket URI to be customized.
But then I dug into how libvirt works a bit more. The reason I had a need to change it is that I'm running libvirtd with qemu in "session" mode so that I don't have to run as root. But after carefully reading https://libvirt.org/daemons.html I switched my config to running qemuvirtd in (modular) instead of libvirtd (monolith) in session mode. Once I enabled virtproxyd as well, it "proxied" the UNIX sock connection from the (old) default /var/run/libvirt/libvirt-sock location to my actual socket location. Everything worked at that point without having to make any modifications to the provider.
Since libvirt introduced modular deamons, I think this is valid feature request to be able to specify socket to connect to.
System Information
Linux distribution
Red Hat Enterprise Linux release 8.8 (Ootpa)
Terraform version
Provider and libvirt versions
Checklist
[ ] Is your issue/contribution related with enabling some setting/option exposed by libvirt that the plugin does not yet support, or requires changing/extending the provider terraform schema?
[X] Is it a bug or something that does not work as expected? Please make sure you fill the version information below:
Description of Issue/Question
Setup
Steps to Reproduce Issue
It seems as if the
socket
parameter is ignored. It always tries to connect to the default file:defaultUnixSock = "/var/run/libvirt/libvirt-sock"
.The directory
/var/run/libvirt
contains these files:(Include debug logs if possible and relevant).
tf-debug-trace.log
Additional information:
Do you have SELinux or Apparmor/Firewall enabled? Some special configuration? Have you tried to reproduce the issue without them enabled?
n/a