Snowflake-Labs / terraform-provider-snowflake

Terraform provider for managing Snowflake accounts
https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest
MIT License
514 stars 404 forks source link

[Bug]: The terraform-provider-snowflake_v0.92.0.exe plugin crashed! #2879

Open UttamChavanCvt opened 3 weeks ago

UttamChavanCvt commented 3 weeks ago

Terraform CLI Version

v1.8.1

Terraform Provider Version

v0.92.0

Terraform Configuration

provider "snowflake" {
  user = var.snowflake_username
  account  = var.snowflake_account
  #region   = var.snowflake_region
  role = var.snowflake_role
  authenticator = "Okta"
 }

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

╷
│ 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.92.0.exe plugin:

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

goroutine 13 [running]:
net/url.(*URL).String(0x0)
        net/url/url.go:810 +0x3b
github.com/snowflakedb/gosnowflake.DSN(0xd0b5200)
        github.com/snowflakedb/gosnowflake@v1.10.0/dsn.go:183 +0xa08
github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk.NewClient(0xd0b5200)
        github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk/client.go:147 +0x109
github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/provider.ConfigureProvider(0xcfbcaa0)
        github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/provider/provider.go:789 +0x1cca
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Provider).Configure(0xcc9b0e0, {0x2229ad0, 0xce86570}, 0xd094210)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/provider.go:296 +0x19e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ConfigureProvider(0xcf572a0, {0x2229ad0, 0xce86438}, 0xcb7d210)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/grpc_provider.go:611 +0x404
github.com/hashicorp/terraform-plugin-mux/tf5to6server.v5tov6Server.ConfigureProvider({{0x223378c, 0xcf572a0}}, {0x2229ad0, 0xce86438}, 0xcb7ca30)
        github.com/hashicorp/terraform-plugin-mux@v0.15.0/tf5to6server/tf5to6server.go:86 +0x109
github.com/hashicorp/terraform-plugin-mux/tf6muxserver.(*muxServer).ConfigureProvider(0xcfbd7c0, {0x2229ad0, 0xce86360}, 0xcb7ca30)        
        github.com/hashicorp/terraform-plugin-mux@v0.15.0/tf6muxserver/mux_server_ConfigureProvider.go:28 +0x15d
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ConfigureProvider(0xcfbdb30, {0x2229ad0, 0xce86048}, 0xd086060)     
        github.com/hashicorp/terraform-plugin-go@v0.22.2/tfprotov6/tf6server/server.go:558 +0x2ec
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ConfigureProvider_Handler({0x1e376a0, 0xcfbdb30}, {0x2229ad0, 0xce86048}, 0xcea8080, 0x0)
        github.com/hashicorp/terraform-plugin-go@v0.22.2/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:464 +0x176
google.golang.org/grpc.(*Server).processUnaryRPC(0xc8f3680, {0x2229ad0, 0xce86018}, {0x22323d4, 0xc85ab00}, 0xd096aa0, 0xcd4ee40, 0x2fe7128, 0x0)
        google.golang.org/grpc@v1.63.2/server.go:1369 +0xf89
google.golang.org/grpc.(*Server).handleStream(0xc8f3680, {0x22323d4, 0xc85ab00}, 0xd096aa0)
        google.golang.org/grpc@v1.63.2/server.go:1780 +0x1108
google.golang.org/grpc.(*Server).serveStreams.func2.1()
        google.golang.org/grpc@v1.63.2/server.go:1019 +0xab

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

Category

category:resource

Object type(s)

No response

Expected Behavior

terraform plan should be run without any plugin crash

Actual Behavior

terraform plan is filing

Steps to Reproduce

terraform { required_providers { snowflake = { source = "Snowflake-Labs/snowflake" version = "0.92.0" } } } provider "snowflake" { user = var.snowflake_username account = var.snowflake_account role = var.snowflake_role authenticator = "Okta" }

terraform plan is causing the issue

How much impact is this issue causing?

High

Logs

No response

Additional Information


Would you like to implement a fix?

sfc-gh-asawicki commented 3 weeks ago

Hey @UttamChavanCvt. Thanks for reaching out to us.

You need to specify okta_url too (currently there is no requirement in the config; we will rework it as part of https://github.com/Snowflake-Labs/terraform-provider-snowflake/blob/main/ROADMAP.md#providers-configuration-rework).

UttamChavanCvt commented 3 weeks ago

Thank you Artur Sawicki, I have tried with providing okta_url value but still face the same issue. Is there any work around for it?

sfc-gh-asawicki commented 3 weeks ago

It should work, so there is no workaround. We just pass the connection parameters to the underlying Gosnowflake driver (you can check the parameters here: https://pkg.go.dev/github.com/snowflakedb/gosnowflake#hdr-Connection_Parameters). But as I said the parameters rework is incoming (https://github.com/Snowflake-Labs/terraform-provider-snowflake/blob/main/ROADMAP.md#providers-configuration-rework).

sfc-gh-asawicki commented 5 days ago

Hey @UttamChavanCvt, were you able to resolve the issue?

UttamChavanCvt commented 18 hours ago

Hi @sfc-gh-asawicki no luck. facing the same issue.

sfc-gh-asawicki commented 14 hours ago

I was able to reproduce the same error when the okta_url was removed from the following config:

  user          = "user_saml_2"
  password      = "***"
  account       = "***.***.us-west-2.aws"
  authenticator = "Okta"
  okta_url      = "https://***.okta.com/"
  role          = "PUBLIC"

so it seems that it works as described.

Can you check if you don't have more provider aliases that may also need this setting? TBH I have no other suggestion.