mulesoft-anypoint / terraform-provider-anypoint

The Anypoint Platform Terraform Provider
https://registry.terraform.io/providers/mulesoft-anypoint/anypoint/latest
MIT License
12 stars 6 forks source link

Bug: changing parent_organization_id on anypoint_bg crashes provider #39

Closed collins-benj closed 5 months ago

collins-benj commented 6 months ago

I created an anypoint_bg with the wrong parent_organization_id within my organization. As such it was nested in the wrong bg upon creation. Attempting to resolve this, I changed parent_organization_id to the correct value, expecting a terraform plan containing either an update-in-place change or (forces replacement) to destroy + re-create in the correct bg. Instead, the provider crashed with the following stack trace:

Stack trace from the terraform-provider-anypoint_v1.6.0.exe plugin:

panic: interface conversion: interface {} is nil, not string

goroutine 2104 [running]:
github.com/mulesoft-anypoint/terraform-provider-anypoint/anypoint.equalTeamRoleContextParams(...)
        github.com/mulesoft-anypoint/terraform-provider-anypoint/anypoint/resource_team_roles.go:300
github.com/mulesoft-anypoint/terraform-provider-anypoint/anypoint.equalTeamRole(...)
        github.com/mulesoft-anypoint/terraform-provider-anypoint/anypoint/resource_team_roles.go:289
github.com/mulesoft-anypoint/terraform-provider-anypoint/anypoint.equalTeamRoles({0xa57140?, 0xc000dce180?}, {0xa57140?, 0xc0009005e8?})
        github.com/mulesoft-anypoint/terraform-provider-anypoint/anypoint/resource_team_roles.go:271 +0x4d0
github.com/mulesoft-anypoint/terraform-provider-anypoint/anypoint.resourceTeamRoles.func1({0xc000784600?, 0xbfa4e5?}, {0xd6e300?, 0xc000b02000?}, {0xbf9720?, 0x5?}, 0xc00031e500?)
        github.com/mulesoft-anypoint/terraform-provider-anypoint/anypoint/resource_team_roles.go:55 +0x1d5
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.diff(0x6?, {0xd6e300, 0xc000b02000}, {0xbf9720, 0x5}, 0xc00031e500, 0xc000227a80, {0xd71358?, 0xc000227b00}, 0x0)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.0/helper/schema/schema.go:1144 +0x392
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.Diff(0xc0003043c0, {0xd6e300, 0xc000b02000}, 0xc000b06750, 0xc00068fc20, 0x0, {0xbe4e00, 0xc000260000}, 0x0)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.0/helper/schema/schema.go:679 +0x332
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).SimpleDiff(0xd6e530?, {0xd6e300?, 0xc000b02000?}, 0xc000b06750, 0xab9fe0?, {0xbe4e00?, 0xc000260000?})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.0/helper/schema/resource.go:890 +0x65
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).PlanResourceChange(0xc000469bc0, {0xd6e300?, 0xc0000efef0?}, 0xc00069a5f0)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.0/helper/schema/grpc_provider.go:741 +0x976
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).PlanResourceChange(0xc0002ca3c0, {0xd6e300?, 0xc0000ef8c0?}, 0xc0002480e0)
        github.com/hashicorp/terraform-plugin-go@v0.14.0/tfprotov5/tf5server/server.go:783 +0x56b
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_PlanResourceChange_Handler({0xbb1d20?, 0xc0002ca3c0}, {0xd6e300, 0xc0000ef8c0}, 0xc000248070, 0x0)
        github.com/hashicorp/terraform-plugin-go@v0.14.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:367 +0x169
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000180000, {0xd726a8, 0xc000480b60}, 0xc0000d0480, 0xc000233fb0, 0x1493668, 0x0)
        google.golang.org/grpc@v1.48.0/server.go:1295 +0xb18
google.golang.org/grpc.(*Server).handleStream(0xc000180000, {0xd726a8, 0xc000480b60}, 0xc0000d0480, 0x0)
        google.golang.org/grpc@v1.48.0/server.go:1636 +0x9e7
google.golang.org/grpc.(*Server).serveStreams.func1.2()
        google.golang.org/grpc@v1.48.0/server.go:932 +0x8d
created by google.golang.org/grpc.(*Server).serveStreams.func1 in goroutine 36
        google.golang.org/grpc@v1.48.0/server.go:930 +0x246

Error: The terraform-provider-anypoint_v1.6.0.exe 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.
soufi commented 6 months ago

Thanks @collins-benj Will look into this issue.

soufi commented 5 months ago

@collins-benj , I just Looked into your issue, The issue is related to the Team Roles. Can you please give some more information about what you have there ?

soufi commented 5 months ago

I just pushed a fix fixes/equalTeamRoleContextParams, but I need your case to make sure that it's working.

soufi commented 5 months ago

solved in v1.6.1