sysdiglabs / terraform-provider-sysdig

Sysdig Terraform provider. Allow to handle Sysdig Secure policies as code.
https://registry.terraform.io/providers/sysdiglabs/sysdig/latest/docs
Mozilla Public License 2.0
49 stars 48 forks source link

Error: The terraform-provider-sysdig_v0.5.27 plugin crashed! #143

Closed bgsilvait closed 2 years ago

bgsilvait commented 3 years ago

The plugin is crashing due to mishandling of "Unauthorized" when wrong/missing endpoint of Sysdig Platform.

Crash:

terraform { required_providers { sysdig = { source = "sysdiglabs/sysdig" version = "0.5.27" } } }

provider "sysdig" { sysdig_monitor_api_token = "xxxxx" sysdig_secure_api_token = "yyyyyy"

}

resource "sysdig_secure_notification_channel_email" "sample_email" { name = "Example Channel - Email" recipients = ["foo@localhost.com", "bar@localhost.com"] enabled = true notify_when_ok = false notify_when_resolved = false send_test_notification = false }

==

Not crashing shows Error: Unauthorized

terraform { required_providers { sysdig = { source = "sysdiglabs/sysdig" version = "0.5.27" } } }

provider "sysdig" { sysdig_monitor_api_token = "xxxxx" sysdig_secure_api_token = "yyyyyy"

}

resource "sysdig_secure_vulnerability_exception_list" "sample" { name = "Linux vulns" description = "Linux vulnerabilities exceptions" }

Envs:

sysdigtf terraform --version Terraform v1.0.10 on darwin_amd64

The suggestion put the sysdig_monitor_api_token and sysdig_secure_api_token in the examples of the Terraform page (https://registry.terraform.io/providers/sysdiglabs/sysdig/latest/docs#example-usage) and fix the crash with the same way you handle the API return for resource sysdig_secure_vulnerability_exception_list

Happy to chat about bruno silva in our slack :)

stack trace:

Stack trace from the terraform-provider-sysdig_v0.5.27 plugin:

panic: Invalid diagnostic: empty summary. This is always a bug in the provider implementation

goroutine 35 [running]: github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugin/convert.DiagsToProto({0xc0004f09c0, 0x1, 0xc0004c3888}) github.com/hashicorp/terraform-plugin-sdk/v2@v2.8.0/internal/plugin/convert/diagnostics.go:72 +0x2b3 github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugin/convert.AppendProtoDiag({0x0, 0x0, 0x0}, {0x178f680, 0xc000798480}) github.com/hashicorp/terraform-plugin-sdk/v2@v2.8.0/internal/plugin/convert/diagnostics.go:25 +0x99 github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(GRPCProviderServer).ApplyResourceChange(0xc000296798, {0x1982b78, 0xc00070c100}, 0xc0002140f0) github.com/hashicorp/terraform-plugin-sdk/v2@v2.8.0/helper/schema/grpc_provider.go:978 +0xdcb github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(server).ApplyResourceChange(0xc00028b6c0, {0x1982c20, 0xc0005802a0}, 0x1982b78) github.com/hashicorp/terraform-plugin-go@v0.4.0/tfprotov5/tf5server/server.go:332 +0x6c github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x183b3e0, 0xc00028b6c0}, {0x1982c20, 0xc0005802a0}, 0xc0003c22a0, 0x0) github.com/hashicorp/terraform-plugin-go@v0.4.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:380 +0x170 google.golang.org/grpc.(Server).processUnaryRPC(0xc0002ae700, {0x19906b0, 0xc00036a000}, 0xc000586000, 0xc000459410, 0x1eaef60, 0x0) google.golang.org/grpc@v1.41.0/server.go:1279 +0xccf google.golang.org/grpc.(Server).handleStream(0xc0002ae700, {0x19906b0, 0xc00036a000}, 0xc000586000, 0x0) google.golang.org/grpc@v1.41.0/server.go:1608 +0xa2a google.golang.org/grpc.(Server).serveStreams.func1.2() google.golang.org/grpc@v1.41.0/server.go:923 +0x98 created by google.golang.org/grpc.(Server).serveStreams.func1 google.golang.org/grpc@v1.41.0/server.go:921 +0x294

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

github-actions[bot] commented 2 years ago

This issue has been closed due to inactivity.