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 password authentication error #989

Open polatsinan opened 1 year ago

polatsinan commented 1 year ago

System Information

Linux distribution

RHEL 9

Terraform version

Terraform v1.3.6
on linux_amd64
+ provider registry.terraform.io/dmacvicar/libvirt v0.7.0

Provider and libvirt versions

libvirt-8.5.0-7.el9_1

Description of Issue/Question

Setup

terraform {
  required_providers {
    libvirt = {
      source = "dmacvicar/libvirt"
    }
  }
}

provider "libvirt" {
  uri = "qemu+ssh://root:PASS@85.17.x.x:22/system?sshauth=ssh-password"
}

resource "libvirt_volume" "centos7-qcow2" {
  name = "centos7.qcow2"
  pool = "default" 
  source = "https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2"
  format = "qcow2"
}

Steps to Reproduce Issue

I want to have the libvirt connection without a key; I want to use a password in the connection string.

[s@server infra]$ terraform plan
╷
│ Error: failed to dial libvirt: ssh: handshake failed: knownhosts: key is unknown
│ 
│   with provider["registry.terraform.io/dmacvicar/libvirt"],
│   on main.tf line 9, in provider "libvirt":
│    9: provider "libvirt" {
│ 
╵
[s@server infra]$ 

Additional information:

Do you have SELinux or Apparmor/Firewall enabled? Some special configuration? Have you tried to reproduce the issue without them enabled?

paisley commented 3 months ago

I know this is quite old, but for anyone else in the same boat, this error can be resolved by appending known_hosts_verify=ignore to the uri string.