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

ssh: handshake failed: knownhosts: key is unknown #922

Closed nicolaballotta closed 2 years ago

nicolaballotta commented 2 years ago

System Information

MacOS 12.0.1 (from where I run terraform with libvirt provider)

Linux distribution (the host where libvirt is installed)

Ubuntu 20.04.3 LTS

Terraform version

Terraform v1.1.2
on darwin_amd64

Provider and libvirt versions

./terraform-provider-libvirt_v0.6.12 0.6.12

Checklist

Description of Issue/Question

Until today I was using version 0.6.3 of the libvirt provider and everything was working fine. I decided to update to version 0.6.12 and that's what I got. terraform init worked flawlessly.

Setup

terraform {
 required_version = ">= 0.13"
  required_providers {
    libvirt = {
      source  = "registry.terraform.io/dmacvicar/libvirt"
      version = "0.6.12"
    }
  }
}

provider "libvirt" {
  uri = "qemu+ssh://root@${var.libvirt}/system?socket=/var/run/libvirt/libvirt-sock"
}

Steps to Reproduce Issue

Running a terraform plan this is what I get:

Error: failed to dial libvirt: ssh: handshake failed: knownhosts: key is unknown
│
│   with provider["registry.terraform.io/dmacvicar/libvirt"],
│   on main.tf line 11, in provider "libvirt":
│   11: provider "libvirt" {

Terraform init

Initializing the backend...

Initializing provider plugins...
- Finding dmacvicar/libvirt versions matching "0.6.12"...
- Finding latest version of hashicorp/template...
- Installing dmacvicar/libvirt v0.6.12...
- Installed dmacvicar/libvirt v0.6.12 (self-signed, key ID 96B1FE1A8D4E1EAB)
- Installing hashicorp/template v2.2.0...
- Installed hashicorp/template v2.2.0 (signed by HashiCorp)

Partner and community providers are signed by their developers.
If you'd like to know more about provider signing, you can read about it here:
https://www.terraform.io/docs/cli/plugins/signing.html

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.

Debug

2022-01-04T13:17:20.027+0100 [INFO]  Terraform version: 1.1.2
2022-01-04T13:17:20.027+0100 [INFO]  Go runtime version: go1.17.5
2022-01-04T13:17:20.027+0100 [INFO]  CLI args: []string{"terraform", "plan"}
2022-01-04T13:17:20.027+0100 [DEBUG] Attempting to open CLI config file: /Users/acidcrash/.terraformrc
2022-01-04T13:17:20.027+0100 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2022-01-04T13:17:20.027+0100 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
2022-01-04T13:17:20.027+0100 [DEBUG] ignoring non-existing provider search directory /Users/acidcrash/.terraform.d/plugins
2022-01-04T13:17:20.027+0100 [DEBUG] ignoring non-existing provider search directory /Users/acidcrash/Library/Application Support/io.terraform/plugins
2022-01-04T13:17:20.027+0100 [DEBUG] ignoring non-existing provider search directory /Library/Application Support/io.terraform/plugins
2022-01-04T13:17:20.028+0100 [INFO]  CLI command args: []string{"plan"}
2022-01-04T13:17:20.030+0100 [DEBUG] New state was assigned lineage "a69938aa-5cbb-9836-97c7-f37733003ac8"
2022-01-04T13:17:20.153+0100 [DEBUG] checking for provisioner in "."
2022-01-04T13:17:20.172+0100 [DEBUG] checking for provisioner in "/usr/local/bin"
2022-01-04T13:17:20.173+0100 [INFO]  backend/local: starting Plan operation
2022-01-04T13:17:20.175+0100 [DEBUG] created provider logger: level=debug
2022-01-04T13:17:20.175+0100 [INFO]  provider: configuring client automatic mTLS
2022-01-04T13:17:20.184+0100 [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/dmacvicar/libvirt/0.6.12/darwin_amd64/terraform-provider-libvirt_v0.6.12 args=[.terraform/providers/registry.terraform.io/dmacvicar/libvirt/0.6.12/darwin_amd64/terraform-provider-libvirt_v0.6.12]
2022-01-04T13:17:20.186+0100 [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/dmacvicar/libvirt/0.6.12/darwin_amd64/terraform-provider-libvirt_v0.6.12 pid=69250
2022-01-04T13:17:20.187+0100 [DEBUG] provider: waiting for RPC address: path=.terraform/providers/registry.terraform.io/dmacvicar/libvirt/0.6.12/darwin_amd64/terraform-provider-libvirt_v0.6.12
2022-01-04T13:17:20.197+0100 [INFO]  provider.terraform-provider-libvirt_v0.6.12: configuring server automatic mTLS: timestamp=2022-01-04T13:17:20.197+0100
2022-01-04T13:17:20.232+0100 [DEBUG] provider.terraform-provider-libvirt_v0.6.12: plugin address: address=/var/folders/lq/kytqdxxs13s3_cyfjlzxy1f80000gn/T/plugin277666009 network=unix timestamp=2022-01-04T13:17:20.232+0100
2022-01-04T13:17:20.232+0100 [DEBUG] provider: using plugin: version=5
2022-01-04T13:17:20.262+0100 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unimplemented desc = unknown service plugin.GRPCStdio"
2022-01-04T13:17:20.262+0100 [DEBUG] No provider meta schema returned
2022-01-04T13:17:20.264+0100 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/dmacvicar/libvirt/0.6.12/darwin_amd64/terraform-provider-libvirt_v0.6.12 pid=69250
2022-01-04T13:17:20.264+0100 [DEBUG] provider: plugin exited
2022-01-04T13:17:20.264+0100 [DEBUG] created provider logger: level=debug
2022-01-04T13:17:20.264+0100 [INFO]  provider: configuring client automatic mTLS
2022-01-04T13:17:20.273+0100 [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/hashicorp/template/2.2.0/darwin_amd64/terraform-provider-template_v2.2.0_x4 args=[.terraform/providers/registry.terraform.io/hashicorp/template/2.2.0/darwin_amd64/terraform-provider-template_v2.2.0_x4]
2022-01-04T13:17:20.276+0100 [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/hashicorp/template/2.2.0/darwin_amd64/terraform-provider-template_v2.2.0_x4 pid=69251
2022-01-04T13:17:20.276+0100 [DEBUG] provider: waiting for RPC address: path=.terraform/providers/registry.terraform.io/hashicorp/template/2.2.0/darwin_amd64/terraform-provider-template_v2.2.0_x4
2022-01-04T13:17:20.283+0100 [INFO]  provider.terraform-provider-template_v2.2.0_x4: configuring server automatic mTLS: timestamp=2022-01-04T13:17:20.283+0100
2022-01-04T13:17:20.309+0100 [DEBUG] provider.terraform-provider-template_v2.2.0_x4: plugin address: address=/var/folders/lq/kytqdxxs13s3_cyfjlzxy1f80000gn/T/plugin725796910 network=unix timestamp=2022-01-04T13:17:20.308+0100
2022-01-04T13:17:20.309+0100 [DEBUG] provider: using plugin: version=5
2022-01-04T13:17:20.340+0100 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unimplemented desc = unknown service plugin.GRPCStdio"
2022-01-04T13:17:20.340+0100 [DEBUG] No provider meta schema returned
2022-01-04T13:17:20.342+0100 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/hashicorp/template/2.2.0/darwin_amd64/terraform-provider-template_v2.2.0_x4 pid=69251
2022-01-04T13:17:20.342+0100 [DEBUG] provider: plugin exited
2022-01-04T13:17:20.342+0100 [DEBUG] Building and walking validate graph
2022-01-04T13:17:20.342+0100 [DEBUG] adding implicit provider configuration provider["registry.terraform.io/hashicorp/template"], implied first by data.template_file.master_network_config
2022-01-04T13:17:20.342+0100 [DEBUG] ProviderTransformer: "libvirt_volume.ubuntu_master" (*terraform.NodeValidatableResource) needs provider["registry.terraform.io/dmacvicar/libvirt"]
2022-01-04T13:17:20.342+0100 [DEBUG] ProviderTransformer: "libvirt_cloudinit_disk.master_commoninit" (*terraform.NodeValidatableResource) needs provider["registry.terraform.io/dmacvicar/libvirt"]
2022-01-04T13:17:20.342+0100 [DEBUG] ProviderTransformer: "data.template_file.master_network_config" (*terraform.NodeValidatableResource) needs provider["registry.terraform.io/hashicorp/template"]
2022-01-04T13:17:20.342+0100 [DEBUG] ProviderTransformer: "data.template_file.worker_user_data" (*terraform.NodeValidatableResource) needs provider["registry.terraform.io/hashicorp/template"]
2022-01-04T13:17:20.342+0100 [DEBUG] ProviderTransformer: "libvirt_domain.ubuntu_worker" (*terraform.NodeValidatableResource) needs provider["registry.terraform.io/dmacvicar/libvirt"]
2022-01-04T13:17:20.342+0100 [DEBUG] ProviderTransformer: "data.template_file.worker_network_config" (*terraform.NodeValidatableResource) needs provider["registry.terraform.io/hashicorp/template"]
2022-01-04T13:17:20.342+0100 [DEBUG] ProviderTransformer: "data.template_file.master_user_data" (*terraform.NodeValidatableResource) needs provider["registry.terraform.io/hashicorp/template"]
2022-01-04T13:17:20.342+0100 [DEBUG] ProviderTransformer: "libvirt_domain.ubuntu_master" (*terraform.NodeValidatableResource) needs provider["registry.terraform.io/dmacvicar/libvirt"]
2022-01-04T13:17:20.342+0100 [DEBUG] ProviderTransformer: "libvirt_cloudinit_disk.worker_commoninit" (*terraform.NodeValidatableResource) needs provider["registry.terraform.io/dmacvicar/libvirt"]
2022-01-04T13:17:20.342+0100 [DEBUG] ProviderTransformer: "libvirt_volume.ubuntu_worker" (*terraform.NodeValidatableResource) needs provider["registry.terraform.io/dmacvicar/libvirt"]
2022-01-04T13:17:20.342+0100 [DEBUG] ProviderTransformer: "libvirt_network.public4" (*terraform.NodeValidatableResource) needs provider["registry.terraform.io/dmacvicar/libvirt"]
2022-01-04T13:17:20.343+0100 [DEBUG] ReferenceTransformer: "libvirt_network.public4" references: []
2022-01-04T13:17:20.343+0100 [DEBUG] ReferenceTransformer: "var.ssh_key" references: []
2022-01-04T13:17:20.343+0100 [DEBUG] ReferenceTransformer: "output.masters" references: [libvirt_domain.ubuntu_master]
2022-01-04T13:17:20.343+0100 [INFO]  ReferenceTransformer: reference not found: "count.index"
2022-01-04T13:17:20.343+0100 [DEBUG] ReferenceTransformer: "libvirt_volume.ubuntu_worker" references: [var.worker_count]
2022-01-04T13:17:20.343+0100 [DEBUG] ReferenceTransformer: "var.libvirt" references: []
2022-01-04T13:17:20.343+0100 [INFO]  ReferenceTransformer: reference not found: "count.index"
2022-01-04T13:17:20.343+0100 [INFO]  ReferenceTransformer: reference not found: "count.index"
2022-01-04T13:17:20.343+0100 [INFO]  ReferenceTransformer: reference not found: "count.index"
2022-01-04T13:17:20.343+0100 [DEBUG] ReferenceTransformer: "libvirt_domain.ubuntu_worker" references: [var.worker_count libvirt_cloudinit_disk.worker_commoninit var.vcpu var.worker_memory libvirt_network.public4 libvirt_volume.ubuntu_worker]
2022-01-04T13:17:20.343+0100 [INFO]  ReferenceTransformer: reference not found: "count.index"
2022-01-04T13:17:20.343+0100 [INFO]  ReferenceTransformer: reference not found: "count.index"
2022-01-04T13:17:20.343+0100 [INFO]  ReferenceTransformer: reference not found: "count.index"
2022-01-04T13:17:20.343+0100 [DEBUG] ReferenceTransformer: "libvirt_cloudinit_disk.master_commoninit" references: [var.master_count data.template_file.master_network_config data.template_file.master_user_data]
2022-01-04T13:17:20.343+0100 [INFO]  ReferenceTransformer: reference not found: "path.module"
2022-01-04T13:17:20.343+0100 [INFO]  ReferenceTransformer: reference not found: "count.index"
2022-01-04T13:17:20.343+0100 [DEBUG] ReferenceTransformer: "data.template_file.worker_network_config" references: [var.worker_count]
2022-01-04T13:17:20.343+0100 [INFO]  ReferenceTransformer: reference not found: "path.module"
2022-01-04T13:17:20.343+0100 [INFO]  ReferenceTransformer: reference not found: "count.index"
2022-01-04T13:17:20.343+0100 [DEBUG] ReferenceTransformer: "data.template_file.master_user_data" references: [var.master_count var.ssh_key]
2022-01-04T13:17:20.343+0100 [DEBUG] ReferenceTransformer: "var.vcpu" references: []
2022-01-04T13:17:20.343+0100 [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/dmacvicar/libvirt\"]" references: [var.libvirt]
2022-01-04T13:17:20.343+0100 [INFO]  ReferenceTransformer: reference not found: "count.index"
2022-01-04T13:17:20.343+0100 [DEBUG] ReferenceTransformer: "libvirt_volume.ubuntu_master" references: [var.master_count]
2022-01-04T13:17:20.343+0100 [INFO]  ReferenceTransformer: reference not found: "count.index"
2022-01-04T13:17:20.343+0100 [INFO]  ReferenceTransformer: reference not found: "count.index"
2022-01-04T13:17:20.343+0100 [INFO]  ReferenceTransformer: reference not found: "count.index"
2022-01-04T13:17:20.343+0100 [DEBUG] ReferenceTransformer: "libvirt_cloudinit_disk.worker_commoninit" references: [var.worker_count data.template_file.worker_network_config data.template_file.worker_user_data]
2022-01-04T13:17:20.343+0100 [INFO]  ReferenceTransformer: reference not found: "path.module"
2022-01-04T13:17:20.343+0100 [INFO]  ReferenceTransformer: reference not found: "count.index"
2022-01-04T13:17:20.343+0100 [DEBUG] ReferenceTransformer: "data.template_file.master_network_config" references: [var.master_count]
2022-01-04T13:17:20.343+0100 [INFO]  ReferenceTransformer: reference not found: "path.module"
2022-01-04T13:17:20.343+0100 [INFO]  ReferenceTransformer: reference not found: "count.index"
2022-01-04T13:17:20.343+0100 [DEBUG] ReferenceTransformer: "data.template_file.worker_user_data" references: [var.worker_count var.ssh_key]
2022-01-04T13:17:20.343+0100 [DEBUG] ReferenceTransformer: "var.master_count" references: []
2022-01-04T13:17:20.343+0100 [DEBUG] ReferenceTransformer: "var.worker_count" references: []
2022-01-04T13:17:20.343+0100 [DEBUG] ReferenceTransformer: "var.master_memory" references: []
2022-01-04T13:17:20.343+0100 [DEBUG] ReferenceTransformer: "var.worker_memory" references: []
2022-01-04T13:17:20.344+0100 [INFO]  ReferenceTransformer: reference not found: "count.index"
2022-01-04T13:17:20.344+0100 [INFO]  ReferenceTransformer: reference not found: "count.index"
2022-01-04T13:17:20.344+0100 [INFO]  ReferenceTransformer: reference not found: "count.index"
2022-01-04T13:17:20.344+0100 [DEBUG] ReferenceTransformer: "libvirt_domain.ubuntu_master" references: [var.master_count libvirt_cloudinit_disk.master_commoninit var.vcpu var.master_memory libvirt_network.public4 libvirt_volume.ubuntu_master]
2022-01-04T13:17:20.344+0100 [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/hashicorp/template\"]" references: []
2022-01-04T13:17:20.344+0100 [DEBUG] ReferenceTransformer: "output.workers" references: [libvirt_domain.ubuntu_worker]
2022-01-04T13:17:20.345+0100 [DEBUG] Starting graph walk: walkValidate
2022-01-04T13:17:20.345+0100 [DEBUG] created provider logger: level=debug
2022-01-04T13:17:20.345+0100 [INFO]  provider: configuring client automatic mTLS
2022-01-04T13:17:20.354+0100 [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/dmacvicar/libvirt/0.6.12/darwin_amd64/terraform-provider-libvirt_v0.6.12 args=[.terraform/providers/registry.terraform.io/dmacvicar/libvirt/0.6.12/darwin_amd64/terraform-provider-libvirt_v0.6.12]
2022-01-04T13:17:20.356+0100 [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/dmacvicar/libvirt/0.6.12/darwin_amd64/terraform-provider-libvirt_v0.6.12 pid=69252
2022-01-04T13:17:20.357+0100 [DEBUG] provider: waiting for RPC address: path=.terraform/providers/registry.terraform.io/dmacvicar/libvirt/0.6.12/darwin_amd64/terraform-provider-libvirt_v0.6.12
2022-01-04T13:17:20.367+0100 [INFO]  provider.terraform-provider-libvirt_v0.6.12: configuring server automatic mTLS: timestamp=2022-01-04T13:17:20.367+0100
2022-01-04T13:17:20.401+0100 [DEBUG] provider.terraform-provider-libvirt_v0.6.12: plugin address: address=/var/folders/lq/kytqdxxs13s3_cyfjlzxy1f80000gn/T/plugin276296059 network=unix timestamp=2022-01-04T13:17:20.401+0100
2022-01-04T13:17:20.401+0100 [DEBUG] provider: using plugin: version=5
2022-01-04T13:17:20.428+0100 [DEBUG] created provider logger: level=debug
2022-01-04T13:17:20.428+0100 [INFO]  provider: configuring client automatic mTLS
2022-01-04T13:17:20.429+0100 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unimplemented desc = unknown service plugin.GRPCStdio"
2022-01-04T13:17:20.429+0100 [DEBUG] No provider meta schema returned
2022-01-04T13:17:20.438+0100 [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/hashicorp/template/2.2.0/darwin_amd64/terraform-provider-template_v2.2.0_x4 args=[.terraform/providers/registry.terraform.io/hashicorp/template/2.2.0/darwin_amd64/terraform-provider-template_v2.2.0_x4]
2022-01-04T13:17:20.441+0100 [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/hashicorp/template/2.2.0/darwin_amd64/terraform-provider-template_v2.2.0_x4 pid=69253
2022-01-04T13:17:20.441+0100 [DEBUG] provider: waiting for RPC address: path=.terraform/providers/registry.terraform.io/hashicorp/template/2.2.0/darwin_amd64/terraform-provider-template_v2.2.0_x4
2022-01-04T13:17:20.448+0100 [INFO]  provider.terraform-provider-template_v2.2.0_x4: configuring server automatic mTLS: timestamp=2022-01-04T13:17:20.448+0100
2022-01-04T13:17:20.473+0100 [DEBUG] provider.terraform-provider-template_v2.2.0_x4: plugin address: address=/var/folders/lq/kytqdxxs13s3_cyfjlzxy1f80000gn/T/plugin170718744 network=unix timestamp=2022-01-04T13:17:20.473+0100
2022-01-04T13:17:20.473+0100 [DEBUG] provider: using plugin: version=5
2022-01-04T13:17:20.505+0100 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unimplemented desc = unknown service plugin.GRPCStdio"
2022-01-04T13:17:20.505+0100 [DEBUG] No provider meta schema returned
2022-01-04T13:17:20.508+0100 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/hashicorp/template/2.2.0/darwin_amd64/terraform-provider-template_v2.2.0_x4 pid=69253
2022-01-04T13:17:20.508+0100 [DEBUG] provider: plugin exited
2022-01-04T13:17:20.511+0100 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/dmacvicar/libvirt/0.6.12/darwin_amd64/terraform-provider-libvirt_v0.6.12 pid=69252
2022-01-04T13:17:20.511+0100 [DEBUG] provider: plugin exited
2022-01-04T13:17:20.511+0100 [INFO]  backend/local: plan calling Plan
2022-01-04T13:17:20.511+0100 [DEBUG] Building and walking plan graph for NormalMode
2022-01-04T13:17:20.511+0100 [DEBUG] adding implicit provider configuration provider["registry.terraform.io/hashicorp/template"], implied first by data.template_file.master_network_config (expand)
2022-01-04T13:17:20.511+0100 [DEBUG] ProviderTransformer: "libvirt_domain.ubuntu_worker (expand)" (*terraform.nodeExpandPlannableResource) needs provider["registry.terraform.io/dmacvicar/libvirt"]
2022-01-04T13:17:20.511+0100 [DEBUG] ProviderTransformer: "data.template_file.master_user_data (expand)" (*terraform.nodeExpandPlannableResource) needs provider["registry.terraform.io/hashicorp/template"]
2022-01-04T13:17:20.511+0100 [DEBUG] ProviderTransformer: "libvirt_volume.ubuntu_master (expand)" (*terraform.nodeExpandPlannableResource) needs provider["registry.terraform.io/dmacvicar/libvirt"]
2022-01-04T13:17:20.511+0100 [DEBUG] ProviderTransformer: "libvirt_network.public4 (expand)" (*terraform.nodeExpandPlannableResource) needs provider["registry.terraform.io/dmacvicar/libvirt"]
2022-01-04T13:17:20.511+0100 [DEBUG] ProviderTransformer: "data.template_file.worker_network_config (expand)" (*terraform.nodeExpandPlannableResource) needs provider["registry.terraform.io/hashicorp/template"]
2022-01-04T13:17:20.511+0100 [DEBUG] ProviderTransformer: "data.template_file.worker_user_data (expand)" (*terraform.nodeExpandPlannableResource) needs provider["registry.terraform.io/hashicorp/template"]
2022-01-04T13:17:20.511+0100 [DEBUG] ProviderTransformer: "libvirt_cloudinit_disk.master_commoninit (expand)" (*terraform.nodeExpandPlannableResource) needs provider["registry.terraform.io/dmacvicar/libvirt"]
2022-01-04T13:17:20.511+0100 [DEBUG] ProviderTransformer: "libvirt_domain.ubuntu_master (expand)" (*terraform.nodeExpandPlannableResource) needs provider["registry.terraform.io/dmacvicar/libvirt"]
2022-01-04T13:17:20.511+0100 [DEBUG] ProviderTransformer: "libvirt_cloudinit_disk.worker_commoninit (expand)" (*terraform.nodeExpandPlannableResource) needs provider["registry.terraform.io/dmacvicar/libvirt"]
2022-01-04T13:17:20.511+0100 [DEBUG] ProviderTransformer: "data.template_file.master_network_config (expand)" (*terraform.nodeExpandPlannableResource) needs provider["registry.terraform.io/hashicorp/template"]
2022-01-04T13:17:20.511+0100 [DEBUG] ProviderTransformer: "libvirt_volume.ubuntu_worker (expand)" (*terraform.nodeExpandPlannableResource) needs provider["registry.terraform.io/dmacvicar/libvirt"]
2022-01-04T13:17:20.512+0100 [INFO]  ReferenceTransformer: reference not found: "count.index"
2022-01-04T13:17:20.512+0100 [DEBUG] ReferenceTransformer: "libvirt_volume.ubuntu_master (expand)" references: [var.master_count]
2022-01-04T13:17:20.512+0100 [INFO]  ReferenceTransformer: reference not found: "path.module"
2022-01-04T13:17:20.512+0100 [INFO]  ReferenceTransformer: reference not found: "count.index"
2022-01-04T13:17:20.512+0100 [DEBUG] ReferenceTransformer: "data.template_file.master_network_config (expand)" references: [var.master_count]
2022-01-04T13:17:20.512+0100 [DEBUG] ReferenceTransformer: "var.worker_memory" references: []
2022-01-04T13:17:20.512+0100 [DEBUG] ReferenceTransformer: "var.vcpu" references: []
2022-01-04T13:17:20.512+0100 [DEBUG] ReferenceTransformer: "var.ssh_key" references: []
2022-01-04T13:17:20.512+0100 [DEBUG] ReferenceTransformer: "output.masters" references: [libvirt_domain.ubuntu_master (expand)]
2022-01-04T13:17:20.512+0100 [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/dmacvicar/libvirt\"]" references: [var.libvirt]
2022-01-04T13:17:20.512+0100 [INFO]  ReferenceTransformer: reference not found: "count.index"
2022-01-04T13:17:20.512+0100 [DEBUG] ReferenceTransformer: "libvirt_volume.ubuntu_worker (expand)" references: [var.worker_count]
2022-01-04T13:17:20.512+0100 [DEBUG] ReferenceTransformer: "libvirt_network.public4 (expand)" references: []
2022-01-04T13:17:20.512+0100 [INFO]  ReferenceTransformer: reference not found: "path.module"
2022-01-04T13:17:20.512+0100 [INFO]  ReferenceTransformer: reference not found: "count.index"
2022-01-04T13:17:20.512+0100 [DEBUG] ReferenceTransformer: "data.template_file.worker_network_config (expand)" references: [var.worker_count]
2022-01-04T13:17:20.512+0100 [INFO]  ReferenceTransformer: reference not found: "count.index"
2022-01-04T13:17:20.512+0100 [INFO]  ReferenceTransformer: reference not found: "count.index"
2022-01-04T13:17:20.512+0100 [INFO]  ReferenceTransformer: reference not found: "count.index"
2022-01-04T13:17:20.512+0100 [DEBUG] ReferenceTransformer: "libvirt_cloudinit_disk.master_commoninit (expand)" references: [var.master_count data.template_file.master_network_config (expand) data.template_file.master_user_data (expand)]
2022-01-04T13:17:20.512+0100 [INFO]  ReferenceTransformer: reference not found: "count.index"
2022-01-04T13:17:20.512+0100 [INFO]  ReferenceTransformer: reference not found: "count.index"
2022-01-04T13:17:20.512+0100 [INFO]  ReferenceTransformer: reference not found: "count.index"
2022-01-04T13:17:20.512+0100 [DEBUG] ReferenceTransformer: "libvirt_domain.ubuntu_worker (expand)" references: [var.worker_count var.worker_memory var.vcpu libvirt_cloudinit_disk.worker_commoninit (expand) libvirt_network.public4 (expand) libvirt_volume.ubuntu_worker (expand)]
2022-01-04T13:17:20.512+0100 [INFO]  ReferenceTransformer: reference not found: "path.module"
2022-01-04T13:17:20.512+0100 [INFO]  ReferenceTransformer: reference not found: "count.index"
2022-01-04T13:17:20.512+0100 [DEBUG] ReferenceTransformer: "data.template_file.master_user_data (expand)" references: [var.master_count var.ssh_key]
2022-01-04T13:17:20.512+0100 [INFO]  ReferenceTransformer: reference not found: "path.module"
2022-01-04T13:17:20.512+0100 [INFO]  ReferenceTransformer: reference not found: "count.index"
2022-01-04T13:17:20.512+0100 [DEBUG] ReferenceTransformer: "data.template_file.worker_user_data (expand)" references: [var.worker_count var.ssh_key]
2022-01-04T13:17:20.512+0100 [DEBUG] ReferenceTransformer: "var.master_count" references: []
2022-01-04T13:17:20.512+0100 [DEBUG] ReferenceTransformer: "var.master_memory" references: []
2022-01-04T13:17:20.512+0100 [DEBUG] ReferenceTransformer: "output.workers" references: [libvirt_domain.ubuntu_worker (expand)]
2022-01-04T13:17:20.512+0100 [INFO]  ReferenceTransformer: reference not found: "count.index"
2022-01-04T13:17:20.512+0100 [INFO]  ReferenceTransformer: reference not found: "count.index"
2022-01-04T13:17:20.512+0100 [INFO]  ReferenceTransformer: reference not found: "count.index"
2022-01-04T13:17:20.512+0100 [DEBUG] ReferenceTransformer: "libvirt_cloudinit_disk.worker_commoninit (expand)" references: [var.worker_count data.template_file.worker_user_data (expand) data.template_file.worker_network_config (expand)]
2022-01-04T13:17:20.512+0100 [INFO]  ReferenceTransformer: reference not found: "count.index"
2022-01-04T13:17:20.512+0100 [INFO]  ReferenceTransformer: reference not found: "count.index"
2022-01-04T13:17:20.512+0100 [INFO]  ReferenceTransformer: reference not found: "count.index"
2022-01-04T13:17:20.512+0100 [DEBUG] ReferenceTransformer: "libvirt_domain.ubuntu_master (expand)" references: [var.master_count var.master_memory libvirt_cloudinit_disk.master_commoninit (expand) var.vcpu libvirt_network.public4 (expand) libvirt_volume.ubuntu_master (expand)]
2022-01-04T13:17:20.512+0100 [DEBUG] ReferenceTransformer: "var.libvirt" references: []
2022-01-04T13:17:20.512+0100 [DEBUG] ReferenceTransformer: "var.worker_count" references: []
2022-01-04T13:17:20.512+0100 [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/hashicorp/template\"]" references: []
2022-01-04T13:17:20.513+0100 [DEBUG] Starting graph walk: walkPlan
2022-01-04T13:17:20.514+0100 [DEBUG] created provider logger: level=debug
2022-01-04T13:17:20.515+0100 [INFO]  provider: configuring client automatic mTLS
2022-01-04T13:17:20.523+0100 [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/hashicorp/template/2.2.0/darwin_amd64/terraform-provider-template_v2.2.0_x4 args=[.terraform/providers/registry.terraform.io/hashicorp/template/2.2.0/darwin_amd64/terraform-provider-template_v2.2.0_x4]
2022-01-04T13:17:20.526+0100 [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/hashicorp/template/2.2.0/darwin_amd64/terraform-provider-template_v2.2.0_x4 pid=69254
2022-01-04T13:17:20.526+0100 [DEBUG] provider: waiting for RPC address: path=.terraform/providers/registry.terraform.io/hashicorp/template/2.2.0/darwin_amd64/terraform-provider-template_v2.2.0_x4
2022-01-04T13:17:20.534+0100 [INFO]  provider.terraform-provider-template_v2.2.0_x4: configuring server automatic mTLS: timestamp=2022-01-04T13:17:20.534+0100
2022-01-04T13:17:20.559+0100 [DEBUG] provider: using plugin: version=5
2022-01-04T13:17:20.559+0100 [DEBUG] provider.terraform-provider-template_v2.2.0_x4: plugin address: address=/var/folders/lq/kytqdxxs13s3_cyfjlzxy1f80000gn/T/plugin205565357 network=unix timestamp=2022-01-04T13:17:20.559+0100
2022-01-04T13:17:20.589+0100 [DEBUG] created provider logger: level=debug
2022-01-04T13:17:20.589+0100 [INFO]  provider: configuring client automatic mTLS
2022-01-04T13:17:20.589+0100 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unimplemented desc = unknown service plugin.GRPCStdio"
2022-01-04T13:17:20.590+0100 [DEBUG] No provider meta schema returned
2022-01-04T13:17:20.599+0100 [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/dmacvicar/libvirt/0.6.12/darwin_amd64/terraform-provider-libvirt_v0.6.12 args=[.terraform/providers/registry.terraform.io/dmacvicar/libvirt/0.6.12/darwin_amd64/terraform-provider-libvirt_v0.6.12]
2022-01-04T13:17:20.602+0100 [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/dmacvicar/libvirt/0.6.12/darwin_amd64/terraform-provider-libvirt_v0.6.12 pid=69255
2022-01-04T13:17:20.602+0100 [DEBUG] provider: waiting for RPC address: path=.terraform/providers/registry.terraform.io/dmacvicar/libvirt/0.6.12/darwin_amd64/terraform-provider-libvirt_v0.6.12
2022-01-04T13:17:20.612+0100 [INFO]  provider.terraform-provider-libvirt_v0.6.12: configuring server automatic mTLS: timestamp=2022-01-04T13:17:20.612+0100
2022-01-04T13:17:20.646+0100 [DEBUG] provider.terraform-provider-libvirt_v0.6.12: plugin address: address=/var/folders/lq/kytqdxxs13s3_cyfjlzxy1f80000gn/T/plugin611669850 network=unix timestamp=2022-01-04T13:17:20.646+0100
2022-01-04T13:17:20.646+0100 [DEBUG] provider: using plugin: version=5
2022-01-04T13:17:20.673+0100 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unimplemented desc = unknown service plugin.GRPCStdio"
2022-01-04T13:17:20.673+0100 [DEBUG] Resource instance state not found for node "data.template_file.master_user_data[0]", instance data.template_file.master_user_data[0]
2022-01-04T13:17:20.673+0100 [INFO]  ReferenceTransformer: reference not found: "var.master_count"
2022-01-04T13:17:20.673+0100 [INFO]  ReferenceTransformer: reference not found: "var.ssh_key"
2022-01-04T13:17:20.673+0100 [INFO]  ReferenceTransformer: reference not found: "count.index"
2022-01-04T13:17:20.673+0100 [INFO]  ReferenceTransformer: reference not found: "path.module"
2022-01-04T13:17:20.673+0100 [DEBUG] ReferenceTransformer: "data.template_file.master_user_data[0]" references: []
2022-01-04T13:17:20.673+0100 [DEBUG] Resource instance state not found for node "data.template_file.master_network_config[0]", instance data.template_file.master_network_config[0]
2022-01-04T13:17:20.673+0100 [INFO]  ReferenceTransformer: reference not found: "var.master_count"
2022-01-04T13:17:20.673+0100 [INFO]  ReferenceTransformer: reference not found: "path.module"
2022-01-04T13:17:20.673+0100 [INFO]  ReferenceTransformer: reference not found: "count.index"
2022-01-04T13:17:20.673+0100 [DEBUG] No provider meta schema returned
2022-01-04T13:17:20.673+0100 [DEBUG] ReferenceTransformer: "data.template_file.master_network_config[0]" references: []
2022-01-04T13:17:20.675+0100 [DEBUG] provider.terraform-provider-libvirt_v0.6.12: 2022/01/04 13:17:20 [DEBUG] Configuring provider for 'qemu+ssh://root@10.10.150.10/system?socket=/var/run/libvirt/libvirt-sock': &{map[uri:0xc0000c23c0] <nil> <nil> 0xc0005167c0 map[] <nil> 0xc000516840 0xc0002803d8 0xc0002ef6d0 false map[] {1 {0 0}} false false}
2022-01-04T13:17:20.676+0100 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/hashicorp/template/2.2.0/darwin_amd64/terraform-provider-template_v2.2.0_x4 pid=69254
2022-01-04T13:17:20.677+0100 [DEBUG] provider: plugin exited
2022-01-04T13:17:20.717+0100 [ERROR] vertex "provider[\"registry.terraform.io/dmacvicar/libvirt\"]" error: failed to dial libvirt: ssh: handshake failed: knownhosts: key is unknown
2022-01-04T13:17:20.718+0100 [INFO]  backend/local: plan operation completed
╷
│ Error: failed to dial libvirt: ssh: handshake failed: knownhosts: key is unknown
│
│   with provider["registry.terraform.io/dmacvicar/libvirt"],
│   on main.tf line 11, in provider "libvirt":
│   11: provider "libvirt" {
│
╵
2022-01-04T13:17:20.721+0100 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/dmacvicar/libvirt/0.6.12/darwin_amd64/terraform-provider-libvirt_v0.6.12 pid=69255
2022-01-04T13:17:20.721+0100 [DEBUG] provider: plugin exited

Additional information:

Apparmor on the host where libvirt is installed, is disabled.

nicolaballotta commented 2 years ago

Never mind, for some reasons my known_hosts file was corrupted. I recreated it, logged in and then run again terraform. Works now.