Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

strange validation on local machine for local libvirt-sock #1089

Open
liyihuang opened this issue Jul 28, 2024 · 3 comments
Open

strange validation on local machine for local libvirt-sock #1089

liyihuang opened this issue Jul 28, 2024 · 3 comments

Comments

@liyihuang
Copy link

liyihuang commented Jul 28, 2024

System Information

Mac or Linux as the client

Linux distribution

Ubuntu 22.04

Terraform version

terraform version
Terraform v1.9.3-dev
on linux_amd64
+ provider registry.terraform.io/dmacvicar/libvirt v0.7.6
+ provider registry.terraform.io/equinix/equinix v2.3.0
+ provider registry.terraform.io/hashicorp/local v2.5.1
+ provider registry.terraform.io/hashicorp/null v3.2.2
+ provider registry.terraform.io/hashicorp/tls v4.0.5
+ provider registry.terraform.io/tenstad/remote v0.1.2
  • [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

 module "infra" {                                                                                                          
   source           = "git::https://github.com/isovalent/terraform-equinix-infra"                                          
   api_key          = var.api_key                                                                                          
   infra_name       = var.infra_name                                                                                       
   k8s_cluster_name = "liyi-ocp"                                                                                           
 }    

Steps to Reproduce Issue

I wrote a module called terraform-equinix-infra(https://github.com/isovalent/terraform-equinix-infra/tree/main). the module is pretty straightforward. It will spin up a baremetal server at https://deploy.equinix.com/, install qemu and a few VM on top of it. However, I found when I run the terraform apply on the laptop that doesn't have the libvirt on it, it will throw out the error saying

dial unix /var/run/libvirt/libvirt-sock: connect: no such file or directory                   
│                                                                                                                          
│   with module.infra.provider["registry.terraform.io/dmacvicar/libvirt"],                                                 
│   on .terraform/modules/infra/providers.tf line 5, in provider "libvirt":                                                
│  

My question is why the provider wants to validate if there is a local unix socket at all? I have to install some packages like to get it working.

apt --yes install --no-install-recommends libguestfs-tools libvirt-daemon-system qemu-system

I'm trying to understand if I missed anything or I didn't configure it correctly

@scabala
Copy link
Contributor

scabala commented Sep 2, 2024

It is not clear from description but I think what you want to do is to connect to remote libvirt instance. In that case, you do not need anything libvirt installed on your laptop.
There are plenty of ways to communicate with remote libvirt daemon. Look here and here.

@liyihuang
Copy link
Author

@scabala thanks for replying and I was on vacation in last 2 weeks. I'm using the ssh as this code shows. https://github.com/isovalent/terraform-equinix-infra/blob/main/providers.tf but it will validate my local libvirt

@scabala
Copy link
Contributor

scabala commented Sep 17, 2024

There might be some conflict when using code directly and when using it from a module. I cannot find the exact issue - there's one already in issue tracker - but long story short, you need to specify exactly the same uri in module and outside of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants