AndrewChubatiuk / terraform-provider-ssh

This provider enables SSH port forwarding in Terraform.
Mozilla Public License 2.0
8 stars 9 forks source link

Provider fails when no private_key provided #12

Open david-jointech opened 9 months ago

david-jointech commented 9 months ago

Terraform Version

1.6.6

Affected Resource(s)

Expected Behavior

Using the provider without defining a private_key in auth should have the provider working as expected.

Actual Behavior

The provider fails during plan with a runtime error (nil pointer).

Steps to Reproduce

  1. Add provider configuring only password in the auth-block
  2. Add a data.ssh_tunnel-resource configuring a connection to the ssh-server
  3. Run terraform plan (or terraform apply).

Panic Output

Stack trace from the terraform-provider-ssh_v0.2.3 plugin:

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

goroutine 29 [running]:
github.com/stefansundin/terraform-provider-ssh/provider.(*SSHProvider).Configure(0x0?, {0xcb8ee0, 0xc00045b3e0}, {{0xc0001c3870, 0x5}, {{{0xcbd068, 0xc0004678f0}, {0xad97c0, 0xc000466930}}, {0xcbe6b0, ...}}}, ...)
        github.com/stefansundin/terraform-provider-ssh/provider/provider.go:179 +0x353
github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(*Server).ConfigureProvider(0xc0001614a0, {0xcb8ee0, 0xc00045b3e0}, 0xc000456440, 0xc0004563c0)
        github.com/hashicorp/terraform-plugin-framework@v1.2.0/internal/fwserver/server_configureprovider.go:15 +0x10f
github.com/hashicorp/terraform-plugin-framework/internal/proto6server.(*Server).ConfigureProvider(0xc0001614a0, {0xcb8ee0?, 0xc00045b290?}, 0xc00045b260?)
        github.com/hashicorp/terraform-plugin-framework@v1.2.0/internal/proto6server/server_configureprovider.go:36 +0x30f
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ConfigureProvider(0xc0001dc780, {0xcb8ee0?, 0xc00045aa80?}, 0xc000456200)
        github.com/hashicorp/terraform-plugin-go@v0.15.0/tfprotov6/tf6server/server.go:527 +0x2d3
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ConfigureProvider_Handler({0xb8b280?, 0xc0001dc780}, {0xcb8ee0, 0xc00045aa80}, 0xc00040caf0, 0x0)
        github.com/hashicorp/terraform-plugin-go@v0.15.0/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:365 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0001da1e0, {0xcbd478, 0xc00040ab60}, 0xc000455680, 0xc0004083c0, 0x1119d58, 0x0)
        google.golang.org/grpc@v1.54.0/server.go:1345 +0xdf3
google.golang.org/grpc.(*Server).handleStream(0xc0001da1e0, {0xcbd478, 0xc00040ab60}, 0xc000455680, 0x0)
        google.golang.org/grpc@v1.54.0/server.go:1722 +0xa36
google.golang.org/grpc.(*Server).serveStreams.func1.2()
        google.golang.org/grpc@v1.54.0/server.go:966 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
        google.golang.org/grpc@v1.54.0/server.go:964 +0x28a

Error: The terraform-provider-ssh_v0.2.3 plugin crashed!

Important Factoids

No