terraform-provider-libvirt: Strange behaviour: failed to dial libvirt
On the very host both commands works fine (localhost ip is 192.168.10.201):
virsh -c qemu:///system list --all
virsh -c qemu+ssh://user@192.168.10.201/system list --all
When terraforming using it’s ok too:
provider "libvirt" {
alias = "node1"
uri = "qemu:///system"
}
But when terraforming using, it’s not good:
provider "libvirt" {
alias = "node1"
uri = "qemu+ssh://user@192.168.10.201/system"
}
module.test-nouvelle-alpine.data.template_file.network_config: Reading...
module.test-nouvelle-alpine.data.template_file.user_data[0]: Reading...
module.test-nouvelle-alpine.data.template_file.network_config: Read complete after 0s [id=142f2ebd49dc333da2f0bf71a7bf27e6acf558cd743fd118b3695d41e5368ec8]
module.test-nouvelle-alpine.data.template_file.user_data[0]: Read complete after 0s [id=5b862b06752472a08f3daeb0d8f77bf3bd2755186a477dd2d5bef90a0d414b69]
╷
│ Error: failed to dial libvirt: failed to connect to libvirt on the remote host: ssh: rejected: connect failed (open failed)
│
│ with provider["registry.terraform.io/dmacvicar/libvirt"].node1,
│ on providers.tf line 1, in provider "libvirt":
│ 1: provider "libvirt" {
│
- By the way host server is an Alpine Linux distro 3.17.2
- terraform-provider-libvirt v0.7.1
- terraform v1.3.4
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 17 (9 by maintainers)
Hooray! After digging deeper I’ve compare /etc/ssh/sshd_config line by line between ubuntu and alpine, and finally found the “guilty” line of configuration. By changing:
AllowTcpForwarding notoAllowTcpForwarding yes!!!@itwars Yeah, if you are confident about your ssh setup, it might be an obscure alpine incompatibilities. My understanding is that they use a lot of different lighter dependencies to make everything smaller which I know can cause some compatibility issues from my superficial usage of it in docker containers.
Unless specific constraints force my hand, I’m happy to stick with Ubuntu/Debian as it just makes my life a lot simpler operationally (there are just so many things to work on and so little time), so I won’t be of much help here but it seems they are well underway to troubleshooting this in the thread you linked.
Best of luck.