launchdarkly / terraform-provider-launchdarkly

Terraform LaunchDarkly provider
https://www.terraform.io/docs/providers/launchdarkly/
Mozilla Public License 2.0
22 stars 24 forks source link

Plugin crashed- Error: Plugin did not respond #142

Closed mohamaa closed 1 year ago

mohamaa commented 1 year ago

`launchdarkly_feature_flag_environment.mohamaa-featurex_env: Creating... ╷ │ Error: Plugin did not respond │ │ with launchdarkly_feature_flag_environment.mohamaa-featurex_env, │ on main.tf line 27, in resource "launchdarkly_feature_flag_environment" "mohamaa-featurex_env": │ 27: resource "launchdarkly_feature_flag_environment" "mohamaa-featurex_env" { │ │ 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-launchdarkly_v2.12.0 plugin:

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

goroutine 83 [running]: github.com/launchdarkly/terraform-provider-launchdarkly/launchdarkly.isPercentRollout(...) github.com/launchdarkly/terraform-provider-launchdarkly/launchdarkly/fallthrough_helper.go:65 github.com/launchdarkly/terraform-provider-launchdarkly/launchdarkly.validateFallThroughResourceData(...) github.com/launchdarkly/terraform-provider-launchdarkly/launchdarkly/fallthrough_helper.go:52 github.com/launchdarkly/terraform-provider-launchdarkly/launchdarkly.fallthroughFromResourceData(0x1a317e0?) github.com/launchdarkly/terraform-provider-launchdarkly/launchdarkly/fallthrough_helper.go:75 +0x528 github.com/launchdarkly/terraform-provider-launchdarkly/launchdarkly.resourceFeatureFlagEnvironmentCreate({0x1c2e928, 0xc000113380}, 0x19a99c0?, {0x1931f40?, 0xc000308900}) github.com/launchdarkly/terraform-provider-launchdarkly/launchdarkly/resource_launchdarkly_feature_flag_environment.go:108 +0x143a github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(Resource).create(0xc0005100e0, {0x1c2e960, 0xc000348210}, 0xd?, {0x1931f40, 0xc000308900}) github.com/hashicorp/terraform-plugin-sdk/v2@v2.16.0/helper/schema/resource.go:707 +0x12e github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(Resource).Apply(0xc0005100e0, {0x1c2e960, 0xc000348210}, 0xc000202680, 0xc000332900, {0x1931f40, 0xc000308900}) github.com/hashicorp/terraform-plugin-sdk/v2@v2.16.0/helper/schema/resource.go:837 +0xa85 github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(GRPCProviderServer).ApplyResourceChange(0xc000314018, {0x1c2e8b8?, 0xc0003095c0?}, 0xc00027cf00) github.com/hashicorp/terraform-plugin-sdk/v2@v2.16.0/helper/schema/grpc_provider.go:1021 +0xe8d github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(server).ApplyResourceChange(0xc00033e000, {0x1c2e960?, 0xc0001f18f0?}, 0xc000263c70) github.com/hashicorp/terraform-plugin-go@v0.9.0/tfprotov5/tf5server/server.go:812 +0x515 github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x1a83580?, 0xc00033e000}, {0x1c2e960, 0xc0001f18f0}, 0xc000112c60, 0x0) github.com/hashicorp/terraform-plugin-go@v0.9.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:385 +0x170 google.golang.org/grpc.(Server).processUnaryRPC(0xc0002ac700, {0x1c32c58, 0xc00031cb60}, 0xc0000d9d40, 0xc000300330, 0x2250800, 0x0) google.golang.org/grpc@v1.46.0/server.go:1283 +0xcfe google.golang.org/grpc.(Server).handleStream(0xc0002ac700, {0x1c32c58, 0xc00031cb60}, 0xc0000d9d40, 0x0) google.golang.org/grpc@v1.46.0/server.go:1620 +0xa2f google.golang.org/grpc.(Server).serveStreams.func1.2() google.golang.org/grpc@v1.46.0/server.go:922 +0x98 created by google.golang.org/grpc.(Server).serveStreams.func1 google.golang.org/grpc@v1.46.0/server.go:920 +0x28a

Error: The terraform-provider-launchdarkly_v2.12.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.`

lucywyman commented 1 year ago

Oh interesting - do you have a snippet of your Terraform manifest we can use to reproduce? Probably just the feature_flag resource.

mohamaa commented 1 year ago

Oh interesting - do you have a snippet of your Terraform manifest we can use to reproduce? Probably just the feature_flag resource.

`data "launchdarkly_team_member" "tesla" { email = "xxxx@abc.com" }

data "launchdarkly_environment" "dev" { key = "development" project_key = "projectx" }

Create a new feature flag

resource "launchdarkly_feature_flag" "mohamaa-featurex" { project_key = "projectx" name = "mohamaa-featurex" key = "mohamaa-featurexx" description = "Adds the FeatureX to the displayed interface" tags = ["managed-by-terraform"] maintainer_id = data.launchdarkly_team_member.tesla.id variation_type = "boolean" variations { value = true } variations { value = false } }

resource "launchdarkly_feature_flag_environment" "mohamaa-featurex_env" { flag_id = launchdarkly_feature_flag.mohamaa-featurex.id env_key = data.launchdarkly_environment.dev.key on = true fallthrough {

rollout_weights = [60000, 40000, 0]

# context_kind = "account"
# bucket_by = "accountId"

} off_variation = 2 } `

sloloris commented 1 year ago

Hi @mohamaa ! I hope you managed to get past this, but it is due to the definition of an empty fallthrough block. Also, your configuration will fail again because the off_variation index exceeds the number of variations defined on the flag - we do not backfill extra variations without explicit definition.

Nonetheless, panicking is definitely not a desired behavior and we will consider this a bug in the provider to be fixed ASAP. Thank you for bringing this to our attention!