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

Fix/issue 5 #7

Closed soufi closed 1 year ago

soufi commented 1 year ago

Fixes issue on resource_team_roles where sorting empty context_params causes crash:

github.com/mulesoft-consulting/terraform-provider-anypoint/anypoint.equalTeamRoles.sortMapListRoles.func6(0x1400047a600?, 0x10594b780?)
        /Users/xxx/Workspaces/CAT/terraform-provider-anypoint/anypoint/resource_team_roles.go:340 +0x570
sort.insertionSort_func({0x140004c69e8?, 0x1400036dbf0?}, 0x0, 0x3)
        /opt/homebrew/Cellar/go/1.21.0/libexec/src/sort/zsortfunc.go:12 +0xc0
sort.stable_func({0x140004c69e8?, 0x1400036dbf0?}, 0x3)
        /opt/homebrew/Cellar/go/1.21.0/libexec/src/sort/zsortfunc.go:343 +0x6c
sort.SliceStable({0x1051faac0?, 0x140002022e8?}, 0x4?)
        /opt/homebrew/Cellar/go/1.21.0/libexec/src/sort/slice.go:38 +0xec
github.com/mulesoft-consulting/terraform-provider-anypoint/anypoint.sortMapListRoles(...)
        /Users/xxx/Workspaces/CAT/terraform-provider-anypoint/anypoint/resource_team_roles.go:326
github.com/mulesoft-consulting/terraform-provider-anypoint/anypoint.equalTeamRoles({0x1051faac0?, 0x14000202048?}, {0x1051faac0?, 0x14000202180?})
        /Users/xxx/Workspaces/CAT/terraform-provider-anypoint/anypoint/resource_team_roles.go:275 +0x2d8
github.com/mulesoft-consulting/terraform-provider-anypoint/anypoint.resourceTeamRoles.func1({0x140004c6d38?, 0x1053703e8?}, {0x140002808d0?, 0x10504f7e2?}, {0x5?, 0x14000429040?}, 0x140004c6d98?)
        /Users/xxx/Workspaces/CAT/terraform-provider-anypoint/anypoint/resource_team_roles.go:57 +0x130
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.diff(0x140004c7188?, {0x1053703e8, 0x140002808d0}, {0x10504f7e2, 0x5}, 0x14000429040, 0x140001b1400, {0x1053733d8?, 0x140001b1580}, 0x0)
        /Users/xxx/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.0/helper/schema/schema.go:1144 +0x268
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.Diff(0x1400007aae0, {0x1053703e8, 0x140002808d0}, 0x140003328f0, 0x14000281710, 0x0, {0x105349ea0, 0x1400059e210}, 0x0)
        /Users/xxx/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.0/helper/schema/schema.go:679 +0x298
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).SimpleDiff(0x105370618?, {0x1053703e8?, 0x140002808d0?}, 0x140003328f0, 0x10524e3a0?, {0x105349ea0?, 0x1400059e210?})
        /Users/xxx/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.0/helper/schema/resource.go:890 +0x4c
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).PlanResourceChange(0x1400000e078, {0x1053703e8?, 0x140002807e0?}, 0x1400052a640)
        /Users/xxx/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.0/helper/schema/grpc_provider.go:741 +0x830
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).PlanResourceChange(0x14000434320, {0x1053703e8?, 0x14000280180?}, 0x140002161c0)
        /Users/xxx/go/pkg/mod/github.com/hashicorp/terraform-plugin-go@v0.14.0/tfprotov5/tf5server/server.go:783 +0x3c0
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_PlanResourceChange_Handler({0x10532cde0?, 0x14000434320}, {0x1053703e8, 0x14000280180}, 0x14000216150, 0x0)
        /Users/xxx/go/pkg/mod/github.com/hashicorp/terraform-plugin-go@v0.14.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:367 +0x164
google.golang.org/grpc.(*Server).processUnaryRPC(0x14000406000, {0x105374528, 0x140000ab1e0}, 0x140000ffd40, 0x14000472120, 0x10593e988, 0x0)
        /Users/xxx/go/pkg/mod/google.golang.org/grpc@v1.48.0/server.go:1295 +0x954
google.golang.org/grpc.(*Server).handleStream(0x14000406000, {0x105374528, 0x140000ab1e0}, 0x140000ffd40, 0x0)
        /Users/xxx/go/pkg/mod/google.golang.org/grpc@v1.48.0/server.go:1636 +0x7c4
google.golang.org/grpc.(*Server).serveStreams.func1.2()
        /Users/xxx/go/pkg/mod/google.golang.org/grpc@v1.48.0/server.go:932 +0x84
created by google.golang.org/grpc.(*Server).serveStreams.func1 in goroutine 41
        /Users/xxx/go/pkg/mod/google.golang.org/grpc@v1.48.0/server.go:930 +0x244
Exiting.