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

v0.8.0 plugin crahes #1105

Open
mvrk69 opened this issue Sep 30, 2024 · 7 comments
Open

v0.8.0 plugin crahes #1105

mvrk69 opened this issue Sep 30, 2024 · 7 comments

Comments

@mvrk69
Copy link

mvrk69 commented Sep 30, 2024

System Information

Linux distribution

Fedora 40

Terraform version

Terraform v1.9.6
on linux_amd64
+ provider registry.terraform.io/dmacvicar/libvirt v0.8.0

Description of Issue/Question

Setup

00-provider.tf
terraform {
required_providers {
libvirt = {
source = "dmacvicar/libvirt"
}
}
}

provider "libvirt" {
uri = "qemu+ssh://root@${var.compute_host}/system?keyfile=${var.keyfile}&sshauth=privkey"
}


01-variables.tf
variable "compute_host" {
description = "Compute Hostname"
type = string
}

variable "keyfile" {
description = "Compute host ssh key"
type = string
}

variable "datastore" {
description = "Datastore"
type = string
}


02-variables-values.tfvars
compute_host = "xxx.xxx.xxx.xxx"
keyfile = "/home/user/.ssh/id_rsa"
datastore = "vms"


Steps to Reproduce Issue

terraform plan -var-file="02-variables-values.tfvars"

Planning failed. Terraform encountered an error while generating this plan.


│ Error: Plugin did not respond

│ with provider["registry.terraform.io/dmacvicar/libvirt"],
│ on 00-provider.tf line 13, in provider "libvirt":
│ 13: provider "libvirt" {

│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ConfigureProvider call. The plugin logs may contain more details.

Stack trace from the terraform-provider-libvirt_v0.8.0 plugin:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x79911c]

goroutine 12 [running]:
github.com/kevinburke/ssh_config.(*Config).Get(0x0, {0xc00004e910, 0xb}, {0xe88d73, 0x8})
github.com/kevinburke/[email protected]/config.go:343 +0x5c
github.com/dmacvicar/terraform-provider-libvirt/libvirt/uri.(*ConnectionURI).dialHost(0xc000140170, {0xc00004e910, 0xb}, 0x0, 0x0)
github.com/dmacvicar/terraform-provider-libvirt/libvirt/uri/ssh.go:166 +0x259
github.com/dmacvicar/terraform-provider-libvirt/libvirt/uri.(*ConnectionURI).dialSSH(0xc000140170)
github.com/dmacvicar/terraform-provider-libvirt/libvirt/uri/ssh.go:129 +0x1c5
github.com/dmacvicar/terraform-provider-libvirt/libvirt/uri.(*ConnectionURI).Dial(0xc000140170)
github.com/dmacvicar/terraform-provider-libvirt/libvirt/uri/connection_uri.go:81 +0x3d
github.com/digitalocean/go-libvirt/socket.(*Socket).Connect(0xc000144d20)
github.com/digitalocean/[email protected]/socket/socket.go:141 +0xbd
github.com/digitalocean/go-libvirt.(*Libvirt).ConnectToURI(0xc0001194a0, {0xc00003cfa8, 0xe})
github.com/digitalocean/[email protected]/libvirt.go:287 +0x2c
github.com/dmacvicar/terraform-provider-libvirt/libvirt.(*Config).Client(0xc0000f2450?)
github.com/dmacvicar/terraform-provider-libvirt/libvirt/config.go:36 +0x215
github.com/dmacvicar/terraform-provider-libvirt/libvirt.providerConfigure(0xc000438300)
github.com/dmacvicar/terraform-provider-libvirt/libvirt/provider.go:71 +0x147
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Provider).Configure(0xc0002ae770, {0xfd7228, 0xc000395b90}, 0xc000144af0)
github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/provider.go:359 +0x1bb
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ConfigureProvider(0xc000392870, {0xfd7228?, 0xc000394900?}, 0xc0001483a0)
github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:616 +0x3c5
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).Configure(0xc0002a55e0, {0xfd7228?, 0xc000127e30?}, 0xc0001448c0)
github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:587 +0x342
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_Configure_Handler({0xe5ad20, 0xc0002a55e0}, {0xfd7228, 0xc000127e30}, 0xc0001eb700, 0x0)
github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:491 +0x1a6
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0001e7000, {0xfd7228, 0xc000127da0}, {0xfdc420, 0xc0004f2000}, 0xc0004617a0, 0xc000395800, 0x15da1f0, 0x0)
google.golang.org/[email protected]/server.go:1394 +0xe2b
google.golang.org/grpc.(*Server).handleStream(0xc0001e7000, {0xfdc420, 0xc0004f2000}, 0xc0004617a0)
google.golang.org/[email protected]/server.go:1805 +0xe8b
google.golang.org/grpc.(*Server).serveStreams.func2.1()
google.golang.org/[email protected]/server.go:1029 +0x7f
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 35
google.golang.org/[email protected]/server.go:1040 +0x125

Error: The terraform-provider-libvirt_v0.8.0 plugin crashed!

This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.


Additional information:

Do you have SELinux or Apparmor/Firewall enabled? Some special configuration?
NO

@dmacvicar
Copy link
Owner

@mvrk69
Copy link
Author

mvrk69 commented Oct 2, 2024

Nothing, i don't have .ssh/config, i'm using the default OS ssh settings

@memetb
Copy link
Contributor

memetb commented Oct 3, 2024

@dmacvicar I will inspect this closer, but we should consider whether upgrading the ssh_config itself was the root cause.

What I'm reading from that stack trace is that the crash is in that module.

@mvrk69 are you able to get debug logs please?

TF_LOG=DEBUG terraform apply

@memetb
Copy link
Contributor

memetb commented Oct 3, 2024

@mvrk69 I have tried to replicate this on a debian linux box to no avail. The debug logs will be crucial to assist.

@mvrk69
Copy link
Author

mvrk69 commented Oct 3, 2024

terraform_debug.log

@memetb
Copy link
Contributor

memetb commented Oct 3, 2024

Ok, the wheels start falling off the wagon here.

I will work on a PR for this asap.

@mvrk69: to confirm, if you do touch ~/.ssh/config this error will likely go away. Can you confirm?

@mvrk69
Copy link
Author

mvrk69 commented Oct 4, 2024

Yup, having ~/.ssh/config works, doesn't crash anymore

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

3 participants