salesforce / terraform-provider-anypoint

The official Terraform Provider for Mulesoft Anypoint Platform
https://registry.terraform.io/providers/mulesoft-anypoint/anypoint/latest/docs
MIT License
21 stars 17 forks source link

Changing Business Group Name - panic: interface conversion: interface {} is nil, not string #82

Closed smaglio81 closed 1 year ago

smaglio81 commented 1 year ago

Error StackTrace

Stack trace from the terraform-provider-anypoint_v1.5.1 plugin:

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

goroutine 272 [running]: github.com/mulesoft-consulting/terraform-provider-anypoint/anypoint.sortMapListRoles.func1(0x1?, 0x1?) github.com/mulesoft-consulting/terraform-provider-anypoint/anypoint/resource_team_roles.go:329 +0x585 sort.insertionSort_func({0xc0008029b0?, 0xc0007a5ef0?}, 0x0, 0xa) sort/zsortfunc.go:12 +0xb1 sort.stable_func({0xc0008029b0?, 0xc0007a5ef0?}, 0xa) sort/zsortfunc.go:343 +0x7a sort.SliceStable({0xc995c0, 0xc000776c78}, 0x10?) sort/slice.go:35 +0x85 github.com/mulesoft-consulting/terraform-provider-anypoint/anypoint.sortMapListRoles({0xc00066b700, 0xa, 0x10}) github.com/mulesoft-consulting/terraform-provider-anypoint/anypoint/resource_team_roles.go:315 +0x72 github.com/mulesoft-consulting/terraform-provider-anypoint/anypoint.equalTeamRoles({0xc995c0?, 0xc000776558?}, {0xc995c0?, 0xc000776c48?}) github.com/mulesoft-consulting/terraform-provider-anypoint/anypoint/resource_team_roles.go:264 +0x105 github.com/mulesoft-consulting/terraform-provider-anypoint/anypoint.resourceTeamRoles.func1({0xc000309400?, 0xdf349a?}, {0xf4aec0?, 0xc0005102d0?}, {0xdf2436?, 0x5?}, 0xc0005463c0?) github.com/mulesoft-consulting/terraform-provider-anypoint/anypoint/resource_team_roles.go:56 +0x1ae github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.diff(0x6?, {0xf4aec0, 0xc0005102d0}, {0xdf2436, 0x5}, 0xc0005463c0, 0xc000053600, {0xf4da90?, 0xc000053680}, 0x0) github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.0/helper/schema/schema.go:1144 +0x3a8 github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.Diff(0xc000511740, {0xf4aec0, 0xc0005102d0}, 0xc000378a90, 0xc0006772c0, 0x0, {0xdd5ce0, 0xc000399e40}, 0x0) github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.0/helper/schema/schema.go:679 +0x353 github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(Resource).SimpleDiff(0xf4b5c0?, {0xf4aec0?, 0xc0005102d0?}, 0xc000378a90, 0xcefcc0?, {0xdd5ce0?, 0xc000399e40?}) github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.0/helper/schema/resource.go:890 +0x6c github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(GRPCProviderServer).PlanResourceChange(0xc00011e018, {0xf4aec0?, 0xc000510120?}, 0xc0006cbb30) github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.0/helper/schema/grpc_provider.go:741 +0x9c9 github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(server).PlanResourceChange(0xc00015a140, {0xf4aec0?, 0xc000759a10?}, 0xc0000c9730) github.com/hashicorp/terraform-plugin-go@v0.14.0/tfprotov5/tf5server/server.go:783 +0x574 github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_PlanResourceChange_Handler({0xdbad00?, 0xc00015a140}, {0xf4aec0, 0xc000759a10}, 0xc0000c96c0, 0x0) github.com/hashicorp/terraform-plugin-go@v0.14.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:367 +0x170 google.golang.org/grpc.(Server).processUnaryRPC(0xc00052a000, {0xf4eb00, 0xc00056c9c0}, 0xc000527e60, 0xc0001167e0, 0x14ef748, 0x0) google.golang.org/grpc@v1.48.0/server.go:1295 +0xb2b google.golang.org/grpc.(Server).handleStream(0xc00052a000, {0xf4eb00, 0xc00056c9c0}, 0xc000527e60, 0x0) google.golang.org/grpc@v1.48.0/server.go:1636 +0xa2f google.golang.org/grpc.(Server).serveStreams.func1.2() google.golang.org/grpc@v1.48.0/server.go:932 +0x98 created by google.golang.org/grpc.(*Server).serveStreams.func1 google.golang.org/grpc@v1.48.0/server.go:930 +0x28a

Error: The terraform-provider-anypoint_v1.5.1 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.

Change in the configuration

We were renaming a business group:

image

Please let me know if there is more information that can help.

soufi commented 1 year ago

Hello @smaglio81

Thank you for reaching out.

In order to ease collaboration, can you please join our discord here

Also, the issue appears to be related to your team roles, can you send what you have there ? I would really appreciate having the full list of roles you have.

Thank you,

smaglio81 commented 1 year ago

Thanks.

I did recently join the discord (and I just updated my discord server profile to have the name smaglio81, so I will be easier to see).

I'm not sure if I'm still looking for an answer on this one.

I'm reasonably confident the root of the issue has to do with the mvp template we were/are using. We think that if you define a team, you will also need to define roles for the team. And, I hadn't defined any roles for the team.

We believe that the system attempted to find roles for the new team, which resulted in a nil or empty data set. And, that empty data set eventually caused the error in sortMapListRoles.

With my understanding of the mvp template and anypoint provider at the time I filed this ticket, I think what would have been most useful for me would have been an error message which would help guide me to the missing role definition(s).

My current understanding makes me recognize how difficult that can be.

soufi commented 1 year ago

Hi @smaglio81, Thank you for analysing this and apologies for the late response. The project is open source and any suggestions and PRs are most welcome, please reach out to me on Discord if you need support or assistance. Cheers.