dmacvicar / terraform-provider-libvirt

Terraform provider to provision infrastructure with Linux's KVM using libvirt
Apache License 2.0
1.54k stars 457 forks source link

Connection to libvirt fails with provider version 0.6.9 #865

Closed ebal closed 3 years ago

ebal commented 3 years ago

System Information

Linux distribution

archlinux

Terraform version

$ terraform -v

Terraform v1.0.1
on linux_amd64
+ provider registry.terraform.io/dmacvicar/libvirt v0.6.9
+ provider registry.terraform.io/hashicorp/http v2.1.0
+ provider registry.terraform.io/hashicorp/template v2.2.0

Provider and libvirt versions

./terraform-provider-libvirt -version
terraform-provider-libvirt 0.6.9

$ libvirtd -V
libvirtd (libvirt) 7.3.0

https://github.com/dmacvicar/terraform-provider-libvirt/releases/download/v0.6.9/terraform-provider-libvirt_0.6.9_linux_amd64.zip

Description of Issue/Question

Upgraded my local machine from v0.6.3 to v0.6.9 and authentication has stopped working. Reverting to v0.6.3 (same terraform files) works fine again.

Setup

$ cat Provider.tf 
terraform {
  required_version = ">= 1.0"

  required_providers {
    libvirt = {
      source  = "dmacvicar/libvirt"
      version = "0.6.9"
    }
    http = {
      source  = "hashicorp/http"
      version = "2.1.0"
    }
  }
}

provider "libvirt" {
  uri = "qemu:///system"
}
$ terraform init

Initializing the backend...

Initializing provider plugins...
- Finding latest version of hashicorp/template...
- Finding dmacvicar/libvirt versions matching "0.6.9"...
- Finding hashicorp/http versions matching "2.1.0"...
- Installing hashicorp/template v2.2.0...
- Installed hashicorp/template v2.2.0 (signed by HashiCorp)
- Installing dmacvicar/libvirt v0.6.9...
- Installed dmacvicar/libvirt v0.6.9 (unauthenticated)
- Installing hashicorp/http v2.1.0...
- Installed hashicorp/http v2.1.0 (signed by HashiCorp)

Terraform has created a lock file .terraform.lock.hcl to record the provider
selections it made above. Include this file in your version control repository
so that Terraform can guarantee to make the same selections by default when
you run "terraform init" in the future.

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.

terraform plan -out terraform.out && terraform apply terraform.out
╷
│ Error: failed to connect: authentication required
│ 
│   with provider["registry.terraform.io/dmacvicar/libvirt"],
│   on Provider.tf line 16, in provider "libvirt":
│   16: provider "libvirt" {
│ 
╵

invidian commented 3 years ago

See also https://github.com/digitalocean/go-libvirt/issues/139 and https://github.com/dmacvicar/terraform-provider-libvirt/commit/1a86985cac99cc623a0a123f36df475f9b861991.

dmacvicar commented 3 years ago

v0.6.10 should be available soon from the registry with the Polkit fix from @invidian