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

Terraform Snowflake Error: Plugin did not respond #2489

Closed
sumitbourne opened this issue Feb 12, 2024 · 9 comments
Closed

Terraform Snowflake Error: Plugin did not respond #2489

sumitbourne opened this issue Feb 12, 2024 · 9 comments
Labels
general-usage General help/usage questions

Comments

@sumitbourne
Copy link

Terraform CLI and Provider Versions

Terraform v1.7.3
on windows_386

  • provider registry.terraform.io/hashicorp/aws v5.36.0
  • provider registry.terraform.io/snowflake-labs/snowflake v0.85.0

Terraform Configuration

snowflake = {

  source  = "Snowflake-Labs/snowflake"

  version = "0.85.0"

}

terraform.lock.hcl file:

provider "registry.terraform.io/hashicorp/aws" {
version = "5.36.0"
hashes = [
"h1:jKuvCOVcdzG3uJusgvYG69A464pa8cPcApfNVJXCgvU=",
"zh:0da8409db879b2c400a7d9ed1311ba6d9eb1374ea08779eaf0c5ad0af00ac558",
"zh:1b7521567e1602bfff029f88ccd2a182cdf97861c9671478660866472c3333fa",
"zh:1cab4e6f3a1d008d01df44a52132a90141389e77dbb4ec4f6ac1119333242ecf",
"zh:1df9f73595594ce8293fb21287bcacf5583ae82b9f3a8e5d704109b8cf691646",
"zh:2b5909268db44b6be95ff6f9dc80d5f87ca8f63ba530fe66723c5fdeb17695fc",
"zh:37dd731eeb0bc1b20e3ec3a0cb5eb7a730edab425058ff40f2243438acc82830",
"zh:3e94c76a2b607a1174d10f5712aed16cb32216ac1c91bd6f21749d61a14045ac",
"zh:40e6ba3184d2d3bf283a07feed8b79c1bbc537a91215cac7b3521b9ccb3e503e",
"zh:67e52353fea47eb97825f6eb6fddd1935e0ff3b53a8861d23a70c2babf83ae51",
"zh:6d2e2f390e0c7b2cd2344b1d5d6eec8a1c11cf35d19f1d6f341286f2449e9e10",
"zh:7005483c43926800fad5bb18e27be883dac4339edb83a8f18ccdc7edf86fafc2",
"zh:7073fa7ccaa9b07c2cf7b24550a90e11f4880afd5c53afd51278eff0154692a0",
"zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425",
"zh:a6d48620e526c766faec9aeb20c40a98c1810c69b6699168d725f721dfe44846",
"zh:e29b651b5f39324656f466cd24a54861795cc423a1b58372f4e1d2d2112d10a0",
]
}

provider "registry.terraform.io/snowflake-labs/snowflake" {
version = "0.84.1"
constraints = "0.84.1"
hashes = [
"h1:KZFt5oc7BZQ2mS1VqZxAUe2oCTHfKTT0SoxuzeekBO4=",
"zh:40eba0404c75c4a27bb8c9e980acd5ff954dc4df0c06984abf17023b818b5ad0",
"zh:538972e6844d7d3641871a02daeaf210693291d0f3c153af584c3238112bc5f8",
"zh:72bc7dde924e96652d1c6878431062e71365de77295124d849c44272cd5f45ed",
"zh:82f1f662f17035f4a8addfe4b166cebc068ebc9316112ccf759a061e506109d3",
"zh:87efd717cffc942708bae9c7e0835e0ce0f48cbe5553f694c06a33351bb907e5",
"zh:9c9e18c60629ba86bc83eeb76b26477677025543d84fa7bd773e2cc893e29b45",
"zh:a4eb876c8bb107fb662c9300233af244101f4ee6e654ea7183b5cd17112430a9",
"zh:c132dda96f91cf892bd52ae2e5f672c3feeeef0c3c4809bf40bb455d335f14d6",
"zh:cf9138b867db313ca58085c96bca83f95cee9f30d7bf7fc1209cb125c1c08e76",
"zh:de393acdf4525744ff5db07e8ff905ea1bbd18ab749b6b9c2977501da4301e76",
"zh:f00ee36e348865f57fe8fe346531e498e16a9aefedf7cef8273f10af4b337699",
"zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c",
]
}



I am using Snowflake Lab version 0.85 and latest Terraform version is 1.7.3

Expected Behavior

  1. Terraform should be connected to the Snowflake
  2. Terraform should be connected to the AWS.

Actual Behavior

Error: Plugin did not respond

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

Stack trace from the terraform-provider-snowflake_v0.85.0.exe plugin:

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x1a064ce]

goroutine 70 [running]:
crypto/rsa.(*PrivateKey).Public(...)
crypto/rsa/rsa.go:122
github.com/snowflakedb/gosnowflake.prepareJWTToken(0xcdd0480)
github.com/snowflakedb/gosnowflake@v1.7.1/auth.go:462 +0x2e
github.com/snowflakedb/gosnowflake.createRequestBody(0xcbf3080, 0xcd66480, {{0xcf13259, 0x1c}, {0x23c8e4d, 0x7}, {0xcbdab20, 0x6}, {0x23d31f6, 0x9}}, ...)
github.com/snowflakedb/gosnowflake@v1.7.1/auth.go:425 +0x357
github.com/snowflakedb/gosnowflake.authenticate.func1()
github.com/snowflakedb/gosnowflake@v1.7.1/auth.go:336 +0x77
github.com/snowflakedb/gosnowflake.(*retryHTTP).execute(0xcc62d40)
github.com/snowflakedb/gosnowflake@v1.7.1/retry.go:313 +0x23b
github.com/snowflakedb/gosnowflake.postAuthRestful({0x2743b28, 0x3579b80}, 0xcd66300, 0xcbe4af0, 0xcd663a0, 0xcbe4aa0, 0x45d964b800, 0x7)
github.com/snowflakedb/gosnowflake@v1.7.1/restful.go:198 +0xde
github.com/snowflakedb/gosnowflake.postAuth({0x2743b28, 0x3579b80}, 0xcd8d260, 0xcd66300, 0xcdeeb88, 0xcd663a0, 0xcbe4aa0, 0x45d964b800)
github.com/snowflakedb/gosnowflake@v1.7.1/auth.go:229 +0x365
github.com/snowflakedb/gosnowflake.authenticate({0x2743b28, 0x3579b80}, 0xcbf3080, {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0})
github.com/snowflakedb/gosnowflake@v1.7.1/auth.go:356 +0xead
github.com/snowflakedb/gosnowflake.authenticateWithConfig(0xcbf3080)
github.com/snowflakedb/gosnowflake@v1.7.1/auth.go:547 +0x508
github.com/snowflakedb/gosnowflake.SnowflakeDriver.OpenWithConfig({}, {0x2743b28, 0x3579b80}, {{0xcf13220, 0x7}, {0xcf13200, 0x1e}, {0xcf13200, 0x0}, {0x0, ...}, ...})
github.com/snowflakedb/gosnowflake@v1.7.1/driver.go:43 +0x121
github.com/snowflakedb/gosnowflake.SnowflakeDriver.Open({}, {0xcf13200, 0xf7})
github.com/snowflakedb/gosnowflake@v1.7.1/driver.go:26 +0xfb
github.com/luna-duclos/instrumentedsql.dsnConnector.Connect(...)
github.com/luna-duclos/instrumentedsql@v1.1.3/connector.go:53
github.com/luna-duclos/instrumentedsql.wrappedConnector.Connect({{{0x2735574, 0x24c227c}, {0x27381a4, 0x3579b80}, 0x0, 0x0}, {0x273e5a8, 0xcdb63d0}, 0xcd66080}, {0x2743b28, ...})
github.com/luna-duclos/instrumentedsql@v1.1.3/connector.go:33 +0x1d0
database/sql.(*DB).conn(0xcdb0f30, {0x2743b28, 0x3579b80}, 0x1)
database/sql/sql.go:1387 +0x755
database/sql.(*DB).PingContext.func1(0x1)
database/sql/sql.go:850 +0x47
database/sql.(*DB).retry(0xcdb0f30, 0xcc63610)
database/sql/sql.go:1538 +0x5d
database/sql.(*DB).PingContext(0xcdb0f30, {0x2743b28, 0x3579b80})
database/sql/sql.go:849 +0x7c
database/sql.(*DB).Ping(...)
database/sql/sql.go:867
github.com/jmoiron/sqlx.Connect({0x2403e35, 0x16}, {0xcf13200, 0xf7})
github.com/jmoiron/sqlx@v1.3.5/sqlx.go:642 +0x6d
github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk.NewClient(0xcdd0120)
github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk/client.go:148 +0x139
github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/provider.ConfigureProvider(0xcbe4820)
github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/provider/provider.go:745 +0x1b6f
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Provider).Configure(0xcee51a0, {0x2743b48, 0xcda3038}, 0xce09380)
github.com/hashicorp/terraform-plugin-sdk/v2@v2.31.0/helper/schema/provider.go:296 +0x19e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ConfigureProvider(0xcec7970, {0x2743b48, 0xcda2f00}, 0xcdb3d80)
github.com/hashicorp/terraform-plugin-sdk/v2@v2.31.0/helper/schema/grpc_provider.go:607 +0x404
github.com/hashicorp/terraform-plugin-mux/tf5to6server.v5tov6Server.ConfigureProvider({{0x274d588, 0xcec7970}}, {0x2743b48, 0xcda2f00}, 0xcdb3d50)
github.com/hashicorp/terraform-plugin-mux@v0.13.0/tf5to6server/tf5to6server.go:80 +0x109
github.com/hashicorp/terraform-plugin-mux/tf6muxserver.(*muxServer).ConfigureProvider(0xc9df7c0, {0x2743b48, 0xcda2e28},
0xcdb3d50)
github.com/hashicorp/terraform-plugin-mux@v0.13.0/tf6muxserver/mux_server_ConfigureProvider.go:28 +0x15d
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ConfigureProvider(0xc9de1e0, {0x2743b48, 0xcda2be8}, 0xce14f80)
github.com/hashicorp/terraform-plugin-go@v0.20.0/tfprotov6/tf6server/server.go:568 +0x2e1
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ConfigureProvider_Handler({0x237b3e0, 0xc github.com/hashicorp/terraform-plugin-go@v0.20.0/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:449 +0x176
google.golang.org/grpc.(*Server).processUnaryRPC(0xc94adc0, {0x2743b48, 0xcda2bb8}, {0x274c074, 0xccb9400}, 0xcf595e0, 0xceae1b0, 0x3548f28, 0x0)
google.golang.org/grpc@v1.60.0/server.go:1372 +0xf6a
google.golang.org/grpc.(*Server).handleStream(0xc94adc0, {0x274c074, 0xccb9400}, 0xcf595e0)
google.golang.org/grpc@v1.60.0/server.go:1783 +0x10d0
google.golang.org/grpc.(*Server).serveStreams.func2.1()
google.golang.org/grpc@v1.60.0/server.go:1016 +0x6f
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 68
google.golang.org/grpc@v1.60.0/server.go:1027 +0x123

Error: The terraform-provider-snowflake_v0.85.0.exe 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.

Steps to Reproduce
terraform init
terraform plan

Steps to Reproduce

Steps to Reproduce
terraform init
terraform plan

How much impact is this issue causing?

High

Logs

No response

Additional Information

I am using Snowflake Lab version 0.85 and latest Terraform version is 1.7.3

Can you please fix the issue.

@sumitbourne sumitbourne added the bug Used to mark issues with provider's incorrect behavior label Feb 12, 2024
@sumitbourne
Copy link
Author

sumitbourne commented Feb 12, 2024

When I am using below terraform script then it is throwing an error .

resource "snowflake_role" "testbus_usage_accessRole" {
name = "test_BUS_DEV__test_BUS__USAGE"
comment = "Defined Usage Role for test"
}

@sfc-gh-asawicki
Copy link
Collaborator

Hey @sumitbourne. Thanks for reaching out to us.

It seems, that your provider's config is incorrect. Can you share the provider "snowflake" { ... } configuration block? Please DO NOT SHARE any sensitive information.

@sfc-gh-asawicki sfc-gh-asawicki added general-usage General help/usage questions and removed bug Used to mark issues with provider's incorrect behavior labels Feb 12, 2024
@sumitbourne
Copy link
Author

terraform {

required_providers {

snowflake = {

  source  = "Snowflake-Labs/snowflake"

  version = "0.84.1"

}

}

}

provider "snowflake" {

role = "test_terraform_transform_dev"

account = "******.eu-west-1"

user = "test.terraform.transform.dev"

private_key = data.aws_ssm_parameter.snowflake_private_key.value
authenticator = "JWT"
private_key_passphrase = data.aws_ssm_parameter.snowflake_private_key.value

}

@sumitbourne
Copy link
Author

@sfc-gh-asawicki pls find the provider block

provider "snowflake" {

role = "test_terraform_transform_dev"

account = "******.eu-west-1"

user = "test.terraform.transform.dev"

private_key = data.aws_ssm_parameter.snowflake_private_key.value
authenticator = "JWT"
private_key_passphrase = data.aws_ssm_parameter.snowflake_private_key.value

}

@sfc-gh-asawicki
Copy link
Collaborator

@sumitbourne, this seems to be the same as issue #2317; please check it for details. I suggest doing two things:

  1. Try passing the private key from file private_key = file(path/to/private/key) to validate if this works (I can't see what the contents of data.aws_ssm_parameter.snowflake_private_key are, but I think the private key is not correctly referenced here).
  2. private_key_passphrase uses the same data.aws_ssm_parameter.snowflake_private_key.value as private_key - this may not matter if the key is not encrypted, but if it is, then this is either not correct passphrase or not the correct key.

@sfc-gh-asawicki
Copy link
Collaborator

@sumitbourne were you able to verify the suggestions?

@sumitbourne
Copy link
Author

Yes I was able to resolve the issue.

@joestump
Copy link

@sumitbourne ran into this issue today - mind sharing how you solved it or what the issue was? 🙏🏼

@sumitbourne
Copy link
Author

Share me your provider code, will try to debug it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
general-usage General help/usage questions
Projects
None yet
Development

No branches or pull requests

3 participants