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

Plugin crashes when upating snowflake_resource_monitor #2167

Closed
kalinon opened this issue Nov 1, 2023 · 4 comments · Fixed by #2287
Closed

Plugin crashes when upating snowflake_resource_monitor #2167

kalinon opened this issue Nov 1, 2023 · 4 comments · Fixed by #2287
Labels
bug Used to mark issues with provider's incorrect behavior category:resource resource:resource_monitor Issue connected to the snowflake_resource_monitor resource

Comments

@kalinon
Copy link

kalinon commented Nov 1, 2023

Provider Version

v0.72.0

Terraform Version

1.6.2

Describe the bug

When trying to add a new user to snowflake_resource_monitor it crashes.

Expected behavior

It should update the resource monitor with the additional user

Code samples and commands

The error occured when adding User2 to notify_users

resource "snowflake_resource_monitor" "demo" {
  name         = snowflake_warehouse.demo.name
  credit_quota = 5

  frequency       = "DAILY"
  start_timestamp = "2023-11-01T17:00:00-07:00"
  end_timestamp   = "2024-10-31T17:00:00-07:00"

  notify_triggers           = [75]
  suspend_trigger           = 85
  suspend_immediate_trigger = 95

  notify_users = ["User1", "User2"]
  warehouses   = [snowflake_warehouse.demo.name]
}

Additional context

snowflake_resource_monitor.demo: Modifying... [id=DEMO_WH]
╷
│ Error: Request cancelled
│
│   with snowflake_resource_monitor.demo,
│   on demo.tf line 7, in resource "snowflake_resource_monitor" "demo":
│    7: resource "snowflake_resource_monitor" "demo" {
│
│ The plugin.(*GRPCProvider).ApplyResourceChange request was cancelled.
╵

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

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x8 pc=0x103669608]

goroutine 16 [running]:
github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/resources.UpdateResourceMonitor(0x14000f38300, {0x103f6a760?, 0x14000b0e340?})
	github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/resources/resource_monitor.go:346 +0x1448
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).update(0x103fa88c0?, {0x103fa88c0?, 0x14000f2e870?}, 0xd?, {0x103f6a760?, 0x14000b0e340?})
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:800 +0x134
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0x1400061fb20, {0x103fa88c0, 0x14000f2e870}, 0x14000ef5040, 0x14000f38180, {0x103f6a760, 0x14000b0e340})
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:919 +0x6b0
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0x14000c92018, {0x103fa88c0?, 0x14000f2e750?}, 0x14000f14820)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:1060 +0xb78
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0x14000c9c000, {0x103fa88c0?, 0x14000f03d40?}, 0x14000edb0a0)
	github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:859 +0x3bc
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x103f1dca0?, 0x14000c9c000}, {0x103fa88c0, 0x14000f03d40}, 0x14000edb030, 0x0)
	github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:467 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0x14000780d20, {0x103fb7e20, 0x14000c0cb60}, 0x14000e41560, 0x14000c8a180, 0x104b64c78, 0x0)
	google.golang.org/[email protected]/server.go:1360 +0xcb4
google.golang.org/grpc.(*Server).handleStream(0x14000780d20, {0x103fb7e20, 0x14000c0cb60}, 0x14000e41560, 0x0)
	google.golang.org/[email protected]/server.go:1737 +0x82c
google.golang.org/grpc.(*Server).serveStreams.func1.1()
	google.golang.org/[email protected]/server.go:982 +0x84
created by google.golang.org/grpc.(*Server).serveStreams.func1
	google.golang.org/[email protected]/server.go:980 +0x16c

Error: The terraform-provider-snowflake_v0.72.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.
@kalinon kalinon added the bug Used to mark issues with provider's incorrect behavior label Nov 1, 2023
@kalinon
Copy link
Author

kalinon commented Nov 2, 2023

Also on 0.73.0

@catherine-v
Copy link

Also on 0.80.0 for me

@vgw-rubesh
Copy link

vgw-rubesh commented Dec 19, 2023

I am on 0.77.0 and have the same error:
`Stack trace from the terraform-provider-snowflake_v0.77.0 plugin:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x167e9b1]

goroutine 26532 [running]:
github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/resources.UpdateResourceMonitor(0xc001410b00, {0x1cef780?, 0xc000cdef70?})
github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/resources/resource_monitor.go:330 +0x18b1
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).update(0x2056a40?, {0x2056a40?, 0xc0012e6db0?}, 0xd?, {0x1cef780?, 0xc000cdef70?})
github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:800 +0x178
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc00016b500, {0x2056a40, 0xc0012e6db0}, 0xc0000269c0, 0xc001410980, {0x1cef780, 0xc000cdef70})`

@sfc-gh-asawicki
Copy link
Collaborator

Hey @kalinon. Thanks for reporting the issue.

The fix should be really simple, I will add this today (if it is really as simple as it seems, we will add it to the nearest release).

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:resource_monitor Issue connected to the snowflake_resource_monitor resource
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants