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

[Bug]: Error: The terraform-provider-snowflake_v0.89.0 plugin crashed! #2779

Closed
1 task
Ghaitharar opened this issue May 6, 2024 · 3 comments
Closed
1 task
Labels
category:import general-usage General help/usage questions resource:schema Issue connected to the snowflake_schema resource

Comments

@Ghaitharar
Copy link

Terraform CLI Version

0.89.0

Terraform Provider Version

0.89.0

Terraform Configuration

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

panic: interface conversion: sdk.ObjectIdentifier is sdk.AccountObjectIdentifier, not sdk.DatabaseObjectIdentifier

goroutine 77 [running]:
github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/resources.ReadSchema(0xc000b26880, {0x1cd55c0?, 0xc00008a778?})
github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/resources/schema.go:108 +0x899
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0x24556c8?, {0x24556c8?, 0xc000b4f920?}, 0xd?, {0x1cd55c0?, 0xc00008a778?})
github.com/hashicorp/terraform-plugin-sdk/v2@v2.31.0/helper/schema/resource.go:783 +0x163
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).RefreshWithoutUpgrade(0xc000a809a0, {0x24556c8, 0xc000b4f920}, 0xc000a8f1e0, {0x1cd55c0, 0xc00008a778})
github.com/hashicorp/terraform-plugin-sdk/v2@v2.31.0/helper/schema/resource.go:1089 +0x552
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadResource(0xc0007df650, {0x24556c8?, 0xc000c06240?}, 0xc000d06c80)
github.com/hashicorp/terraform-plugin-sdk/v2@v2.31.0/helper/schema/grpc_provider.go:663 +0x48a
github.com/hashicorp/terraform-plugin-mux/tf5to6server.v5tov6Server.ReadResource({{0x246b560?, 0xc0007df650?}}, {0x24556c8?, 0xc000c06240?}, 0xc001187380?)
github.com/hashicorp/terraform-plugin-mux@v0.13.0/tf5to6server/tf5to6server.go:176 +0x225
github.com/hashicorp/terraform-plugin-mux/tf6muxserver.(*muxServer).ReadResource(0x2455700?, {0x24556c8?, 0xc000883e60?}, 0xc001187380)
github.com/hashicorp/terraform-plugin-mux@v0.13.0/tf6muxserver/mux_server_ReadResource.go:35 +0x193
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ReadResource(0xc0007fcbe0, {0x24556c8?, 0xc000883680?}, 0xc0011a4ae0)
github.com/hashicorp/terraform-plugin-go@v0.20.0/tfprotov6/tf6server/server.go:787 +0x48b
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ReadResource_Handler({0x20288a0?, 0xc0007fcbe0}, {0x24556c8, 0xc000883680}, 0xc000737800, 0x0)
github.com/hashicorp/terraform-plugin-go@v0.20.0/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:467 +0x169
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0000e8d20, {0x24556c8, 0xc0008835f0}, {0x24667e0, 0xc000b84340}, 0xc000a437a0, 0xc000b154d0, 0x345f028, 0x0)
google.golang.org/grpc@v1.60.0/server.go:1372 +0xe03
google.golang.org/grpc.(*Server).handleStream(0xc0000e8d20, {0x24667e0, 0xc000b84340}, 0xc000a437a0)
google.golang.org/grpc@v1.60.0/server.go:1783 +0xfec
google.golang.org/grpc.(*Server).serveStreams.func2.1()
google.golang.org/grpc@v1.60.0/server.go:1016 +0x59
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 42
google.golang.org/grpc@v1.60.0/server.go:1027 +0x115
panic: interface conversion: sdk.ObjectIdentifier is sdk.AccountObjectIdentifier, not sdk.DatabaseObjectIdentifier

goroutine 76 [running]:
github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/resources.ReadSchema(0xc000cce180, {0x1cd55c0?, 0xc00008a778?})
github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/resources/schema.go:108 +0x899
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0x24556c8?, {0x24556c8?, 0xc000c904b0?}, 0xd?, {0x1cd55c0?, 0xc00008a778?})
github.com/hashicorp/terraform-plugin-sdk/v2@v2.31.0/helper/schema/resource.go:783 +0x163
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).RefreshWithoutUpgrade(0xc000a809a0, {0x24556c8, 0xc000c904b0}, 0xc000cae340, {0x1cd55c0, 0xc00008a778})
github.com/hashicorp/terraform-plugin-sdk/v2@v2.31.0/helper/schema/resource.go:1089 +0x552
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadResource(0xc0007df650, {0x24556c8?, 0xc000c90360?}, 0xc000a261c0)
github.com/hashicorp/terraform-plugin-sdk/v2@v2.31.0/helper/schema/grpc_provider.go:663 +0x48a
github.com/hashicorp/terraform-plugin-mux/tf5to6server.v5tov6Server.ReadResource({{0x246b560?, 0xc0007df650?}}, {0x24556c8?, 0xc000c90360?}, 0xc000a26000?)
github.com/hashicorp/terraform-plugin-mux@v0.13.0/tf5to6server/tf5to6server.go:176 +0x225
github.com/hashicorp/terraform-plugin-mux/tf6muxserver.(*muxServer).ReadResource(0x2455700?, {0x24556c8?, 0xc000c90060?}, 0xc000a26000)
github.com/hashicorp/terraform-plugin-mux@v0.13.0/tf6muxserver/mux_server_ReadResource.go:35 +0x193
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ReadResource(0xc0007fcbe0, {0x24556c8?, 0xc000f21770?}, 0xc000bd0780)
github.com/hashicorp/terraform-plugin-go@v0.20.0/tfprotov6/tf6server/server.go:787 +0x48b
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ReadResource_Handler({0x20288a0?, 0xc0007fcbe0}, {0x24556c8, 0xc000f21770}, 0xc000057100, 0x0)
github.com/hashicorp/terraform-plugin-go@v0.20.0/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:467 +0x169
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0000e8d20, {0x24556c8, 0xc000f216e0}, {0x24667e0, 0xc000b84340}, 0xc000a43680, 0xc000b154d0, 0x345f028, 0x0)
google.golang.org/grpc@v1.60.0/server.go:1372 +0xe03
google.golang.org/grpc.(*Server).handleStream(0xc0000e8d20, {0x24667e0, 0xc000b84340}, 0xc000a43680)
google.golang.org/grpc@v1.60.0/server.go:1783 +0xfec
google.golang.org/grpc.(*Server).serveStreams.func2.1()
google.golang.org/grpc@v1.60.0/server.go:1016 +0x59
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 42
google.golang.org/grpc@v1.60.0/server.go:1027 +0x115

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

Category

category:import

Object type(s)

No response

Expected Behavior

plan and apply with no issues.

Actual Behavior

The plugin crushed.

Steps to Reproduce

variable "DEV_schema_map" {
description = "List of GEs"
type = map
default = { for SC in ["DE_1", "DE_2", "DE_3", "DE_4", "DE_5", "DE_6"] : SC => SC}
}

resource "snowflake_schema" "DEV_schemas" {
for_each = var.DEV_schema_map
name = each.value
database = snowflake_database.DEV.name
}

import {
for_each = var.DEV_schema_map
id = each.value
to = snowflake_schema.DEV_schemas[each.value]
}

How much impact is this issue causing?

Medium

Logs

No response

Additional Information

No response

Would you like to implement a fix?

  • Yeah, I'll take it 😎
@Ghaitharar Ghaitharar added the bug Used to mark issues with provider's incorrect behavior label May 6, 2024
@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 May 6, 2024
@sfc-gh-asawicki
Copy link
Collaborator

Hey @Ghaitharar. Thanks for reaching out to us.

Your import statement is incorrect: https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs/resources/schema#import. You have to use qualified name and you are only using the schema name without the db.

@sfc-gh-jcieslak sfc-gh-jcieslak added resource:schema Issue connected to the snowflake_schema resource category:import labels May 20, 2024
@sfc-gh-asawicki
Copy link
Collaborator

Hey @Ghaitharar. Can you confirm that the proposed solution worked?

@sfc-gh-asawicki
Copy link
Collaborator

Closing due to inactivity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:import general-usage General help/usage questions resource:schema Issue connected to the snowflake_schema resource
Projects
None yet
Development

No branches or pull requests

3 participants