The terraform-provider-ssh_v2.6.0 plugin crashed
Opened this issue · 1 comments
kshtsk commented
terraform version: 1.5.5
plugin version: 2.6.0
I've got the following crash:
2023-08-19T00:27:18.854+0200 [ERROR] plugin.(*GRPCProvider).ApplyResourceChange: error="rpc error: code = Unavailable desc = error reading from server: EOF"
2023-08-19T00:27:18.862+0200 [ERROR] vertex "ssh_resource.hello_world[0]" error: Plugin did not respond
╷
│ Error: Plugin did not respond
│
│ with ssh_resource.hello_world[0],
│ on main.tf line 17, in resource "ssh_resource" "hello_world":
│ 17: resource "ssh_resource" "hello_world" {
│
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details.
╵
Stack trace from the terraform-provider-ssh_v2.6.0 plugin:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x10 pc=0x100933c88]
goroutine 40 [running]:
net/http.ProxyFromEnvironment(0x0)
net/http/transport.go:448 +0x28
github.com/loafoe/easyssh-proxy/v2.(*MakeConfig).Connect(0x1400055ac18)
github.com/loafoe/easyssh-proxy/v2@v2.0.4/easyssh.go:215 +0x1d0
github.com/loafoe/easyssh-proxy/v2.(*MakeConfig).Stream(0x0?, {0x14000577cb0, 0xb}, {0x140001cc590, 0x1, 0x1})
github.com/loafoe/easyssh-proxy/v2@v2.0.4/easyssh.go:340 +0x8c
github.com/loafoe/easyssh-proxy/v2.(*MakeConfig).Run(0x1400055a7c8?, {0x14000577cb0?, 0x1400055a868?}, {0x140001cc590?, 0x100000001?, 0x140003a0900?})
github.com/loafoe/easyssh-proxy/v2@v2.0.4/easyssh.go:425 +0x30
github.com/loafoe/terraform-provider-ssh/ssh.runCommands({0x100e196e8, 0x140001f0900}, 0x100d03420?, {0x1400001ba20, 0x2, 0x1012e72e8?}, 0x45d964b800, 0x18?, {0x100d284a0?, 0x14000610360})
github.com/loafoe/terraform-provider-ssh/ssh/resource_resource.go:445 +0x130
github.com/loafoe/terraform-provider-ssh/ssh.mainRun({0x1176592db48?, 0x100b8f60e?}, 0xc1301b1db2b94290?, {0x100d284a0?, 0x14000610360}, 0x0)
github.com/loafoe/terraform-provider-ssh/ssh/resource_resource.go:393 +0x728
github.com/loafoe/terraform-provider-ssh/ssh.resourceResourceCreate({0x100e196e8, 0x140001f0720}, 0x0?, {0x100d284a0, 0x14000610360})
github.com/loafoe/terraform-provider-ssh/ssh/resource_resource.go:425 +0xa4
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0x140000dcee0, {0x100e19720, 0x14000154ba0}, 0xd?, {0x100d284a0, 0x14000610360})
github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.1/helper/schema/resource.go:707 +0xe8
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0x140000dcee0, {0x100e19720, 0x14000154ba0}, 0x1400061a5b0, 0x1400061db80, {0x100d284a0, 0x14000610360})
github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.1/helper/schema/resource.go:837 +0x85c
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0x1400037dfe0, {0x100e19720?, 0x14000154a80?}, 0x1400062c640)
github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.1/helper/schema/grpc_provider.go:1021 +0xb5c
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0x14000222b40, {0x100e19720?, 0x14000154270?}, 0x1400014c3f0)
github.com/hashicorp/terraform-plugin-go@v0.14.1/tfprotov5/tf5server/server.go:818 +0x3b8
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x100de6580?, 0x14000222b40}, {0x100e19720, 0x14000154270}, 0x1400014c380, 0x0)
github.com/hashicorp/terraform-plugin-go@v0.14.1/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:385 +0x164
google.golang.org/grpc.(*Server).processUnaryRPC(0x1400021c1e0, {0x100e1d258, 0x140001024e0}, 0x14000128b40, 0x1400039e3c0, 0x1012a5b00, 0x0)
google.golang.org/grpc@v1.50.1/server.go:1340 +0xb38
google.golang.org/grpc.(*Server).handleStream(0x1400021c1e0, {0x100e1d258, 0x140001024e0}, 0x14000128b40, 0x0)
google.golang.org/grpc@v1.50.1/server.go:1713 +0x80c
google.golang.org/grpc.(*Server).serveStreams.func1.2()
google.golang.org/grpc@v1.50.1/server.go:965 +0x84
created by google.golang.org/grpc.(*Server).serveStreams.func1
google.golang.org/grpc@v1.50.1/server.go:963 +0x278
Error: The terraform-provider-ssh_v2.6.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.
kshtsk commented
The issue is reproducible any time the host
parameter is assigned to incorrect value, for example: any:localhost
. Expected result it to generate human readable error message about incorrect hostname provided.
Steps to reproduce:
- Create
main.tf
:
terraform {
required_version = "1.5.5"
required_providers {
ssh = {
source = "loafoe/ssh"
version = "2.6.0"
}
}
}
variable "hostname" {
type = string
default = "localhost"
}
variable "username" {
type = string
default = null
}
resource "ssh_resource" "hello_world" {
count = 1
host = var.hostname
user = var.username
private_key = file("~/.ssh/id_rsa")
commands = [
"hostname -f",
"uname -a"
]
}
- Run command
terraform apply -auto-approve -var "hostname=any:localhost" -var "username=$USER"