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

Provider v0.84.1 crashes when providing a blank default for a column in the snowflake_table resource #2406

Open
joshcazalas opened this issue Jan 23, 2024 · 1 comment
Labels
bug Used to mark issues with provider's incorrect behavior category:resource resource:table Issue connected to the snowflake_table resource

Comments

@joshcazalas
Copy link

Terraform CLI and Provider Versions

Terraform v1.3.9 linux_amd64

Provider version 0.84.1

Terraform Configuration

resource "snowflake_table" "test_table" {
  name     = "TEST_TABLE"
  database = var.database
  schema   = var.schema
  column {
    name     = "UID"
    type     = "VARCHAR(22)"
    nullable = false
    default {
      constant = ""
    }
  }
}

Expected Behavior

The provider should create a table in Snowflake with a blank string as the default as shown in the screenshot below:

image

Actual Behavior


│ Error: Plugin did not respond

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

Releasing state lock. This may take a few moments...

Stack trace from the terraform-provider-snowflake_v0.84.1 plugin:

panic: interface conversion: interface {} is nil, not map[string]interface {}

goroutine 81 [running]:
github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/resources.getColumn({0x1d6b0e0?, 0xc000ec0300})
github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/resources/table.go:445 +0x4f1
github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/resources.getColumns({0x1c8f260?, 0xc000674988?})
github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/resources/table.go:466 +0xe9
github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/resources.CreateTable(0x0?, {0x1fef440?, 0xc000264c30?})
github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/resources/table.go:500 +0x169
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0x2383a68?, {0x2383a68?, 0xc00066c8a0?}, 0xd?, {0x1fef440?, 0xc000264c30?})
github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:766 +0x163
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc000bd0a80, {0x2383a68, 0xc00066c8a0}, 0xc000665c70, 0xc000db8200, {0x1fef440, 0xc000264c30})
github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:909 +0xa89
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc000977788, {0x2383a68?, 0xc00066c6f0?}, 0xc000b05360)
github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:1074 +0xdbc
github.com/hashicorp/terraform-plugin-mux/tf5to6server.v5tov6Server.ApplyResourceChange({{0x23992a0?, 0xc000977788?}}, {0x2383a68, 0xc00066c6f0}, 0x0?)
github.com/hashicorp/[email protected]/tf5to6server/tf5to6server.go:37 +0x54
github.com/hashicorp/terraform-plugin-mux/tf6muxserver.(*muxServer).ApplyResourceChange(0x2383aa0?, {0x2383a68?, 0xc00066c3f0?}, 0xc000b05310)
github.com/hashicorp/[email protected]/tf6muxserver/mux_server_ApplyResourceChange.go:36 +0x193
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ApplyResourceChange(0xc000b9a140, {0x2383a68?, 0xc0009af9e0?}, 0xc000fbc690)
github.com/hashicorp/[email protected]/tfprotov6/tf6server/server.go:857 +0x56b
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ApplyResourceChange_Handler({0x1fa0960?, 0xc000b9a140}, {0x2383a68, 0xc0009af9e0}, 0xc000177280, 0x0)
github.com/hashicorp/[email protected]/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:503 +0x169
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0000ded20, {0x2383a68, 0xc0009af950}, {0x23945a0, 0xc0006aa000}, 0xc000cc67e0, 0xc000842bd0, 0x335ab58, 0x0)
google.golang.org/[email protected]/server.go:1372 +0xe03
google.golang.org/grpc.(*Server).handleStream(0xc0000ded20, {0x23945a0, 0xc0006aa000}, 0xc000cc67e0)
google.golang.org/[email protected]/server.go:1783 +0xfec
google.golang.org/grpc.(*Server).serveStreams.func2.1()
google.golang.org/[email protected]/server.go:1016 +0x59
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 22
google.golang.org/[email protected]/server.go:1027 +0x115

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

  1. terraform apply

How much impact is this issue causing?

Medium

Logs

No response

Additional Information

Due to business logic that we're unable to change, we have to set the default on certain columns in our Snowflake tables to a blank string, "". When running terraform apply with this in our configuration, the provider crashes with the provided error message. Currently, we're able to work around this by commenting out these blank default values, as the provider works correctly with either a non-blank default value or no default value at all. A fix for this issue would be nice so that we can unblock projects that are currently on hold/remove manual work this creates.

@joshcazalas joshcazalas added the bug Used to mark issues with provider's incorrect behavior label Jan 23, 2024
@sfc-gh-asawicki
Copy link
Collaborator

Hey @joshcazalas. Thanks for reporting the issue.

We are currently migrating table resource to the new implementation, we may be able to analyze it during that process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Used to mark issues with provider's incorrect behavior category:resource resource:table Issue connected to the snowflake_table resource
Projects
None yet
Development

No branches or pull requests

3 participants