[Bug]: No proper error handling for invalid requests
Closed this issue · 1 comments
Terraform Version
v1.6.6
Linode Provider Version
v2.16.0
Effected Terraform Resources
linode_object_storage_key
Terraform Config Files
resource "linode_object_storage_key" "this" {
label = "test-but-a-really-thourough-test-of-length-limitations-for-real-for-real_devops-playground_key"
bucket_access {
bucket_name = "bucket_name"
cluster = "us-iad-1"
permissions = "read_only"
}
}
Debug Output
│ Error: Plugin did not respond
│
│ with module.aran-test.linode_object_storage_key.this[0],
│ on .terraform/modules/aran-test/linode-object-storage-key/main.tf line 17, in resource "linode_object_storage_key" "this":
│ 17: resource "linode_object_storage_key" "this" {
│
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details.
╵
Stack trace from the terraform-provider-linode_v2.16.0 plugin:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x105bb90cc]
goroutine 15 [running]:
github.com/linode/terraform-provider-linode/v2/linode/objkey.(*Resource).Create(0x1400040cc80, {0x1065740c0, 0x140000d2930}, {{{{0x10657bc40, 0x14000aa2de0}, {0x106217b20, 0x140000e9e00}}, {0x1065814d8, 0x140002faff0}}, {{{0x10657bc40, ...}, ...}, ...}, ...}, ...)
github.com/linode/terraform-provider-linode/v2/linode/objkey/framework_resource.go:69 +0x3fc
github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(*Server).CreateResource(0x140003a3860, {0x1065740c0, 0x140000d2930}, 0x14000af14c0, 0x14000af1460)
github.com/hashicorp/terraform-plugin-framework@v1.5.0/internal/fwserver/server_createresource.go:101 +0x430
github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(*Server).ApplyResourceChange(0x14000887620?, {0x1065740c0, 0x140000d2930}, 0x1400040ccd0, 0x14000af1620)
github.com/hashicorp/terraform-plugin-framework@v1.5.0/internal/fwserver/server_applyresourcechange.go:57 +0x370
github.com/hashicorp/terraform-plugin-framework/internal/proto5server.(*Server).ApplyResourceChange(0x140003a3860, {0x1065740c0?, 0x140000d27e0?}, 0x1400040cbe0)
github.com/hashicorp/terraform-plugin-framework@v1.5.0/internal/proto5server/server_applyresourcechange.go:55 +0x314
github.com/hashicorp/terraform-plugin-mux/tf5muxserver.(*muxServer).ApplyResourceChange(0x106574018?, {0x1065740c0?, 0x140000d24b0?}, 0x1400040cbe0)
github.com/hashicorp/terraform-plugin-mux@v0.14.0/tf5muxserver/mux_server_ApplyResourceChange.go:36 +0x188
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0x14000538be0, {0x1065740c0?, 0x140007d7aa0?}, 0x14000310230)
github.com/hashicorp/terraform-plugin-go@v0.21.0/tfprotov5/tf5server/server.go:845 +0x2b0
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x1064b80e0?, 0x14000538be0}, {0x1065740c0, 0x140007d7aa0}, 0x140000b4480, 0x0)
github.com/hashicorp/terraform-plugin-go@v0.21.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:518 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0x140000dc600, {0x1065740c0, 0x140007d7a10}, {0x10657cff8, 0x14000602820}, 0x14000411440, 0x140007d70e0, 0x10758ce78, 0x0)
google.golang.org/grpc@v1.61.0/server.go:1385 +0xc6c
google.golang.org/grpc.(*Server).handleStream(0x140000dc600, {0x10657cff8, 0x14000602820}, 0x14000411440)
google.golang.org/grpc@v1.61.0/server.go:1796 +0xc9c
google.golang.org/grpc.(*Server).serveStreams.func2.1()
google.golang.org/grpc@v1.61.0/server.go:1029 +0x8c
created by google.golang.org/grpc.(*Server).serveStreams.func2
google.golang.org/grpc@v1.61.0/server.go:1040 +0x160
Error: The terraform-provider-linode_v2.16.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.
Panic Output
No response
Expected Behavior
Underlying issue here is the label name is too long, so I would expect the provider to fail with a fitting error that explains it.
Currently it just leaves us having to try and figure out why it's failing.
The same issue occurs for example if I try to create an access key with permissions for over 50 buckets, and at this case as well, we are left to take a guess why this happens and try to play around with it.
Since I already noticed this with 2 different cases in linode_object_storage_key, I assume this is there in additional resources and cases.
So generally the issue here is error handling, the provider should fail with appropriate errors, and perhaps even validate locally in advance.
Actual Behavior
The provider is crashing with unreadable internal errors
Steps to Reproduce
Run apply on a linode_object_storage_key with a name longer than 50 chars
Thanks for the report!
This seems like a simple oversight on our end. I created a ticket in our internal tracker to fix the error handling on Object Storage key creation.