Skip to content

Bug Fix, Empty Group#42

Open
samatspothero wants to merge 6 commits into
frankfarrell:masterfrom
samatspothero:master
Open

Bug Fix, Empty Group#42
samatspothero wants to merge 6 commits into
frankfarrell:masterfrom
samatspothero:master

Conversation

@samatspothero
Copy link
Copy Markdown
Contributor

When removing the only user from a group, this code was failing because the db connection was returning an empty array "{}" instead of a null. This was causing the cast to integer a few lines down to fail with

panic: strconv.Atoi: parsing "": invalid syntax

This PR changes the code to check for that case and enter the else branch to assign an empty array to the state.

@samatspothero
Copy link
Copy Markdown
Contributor Author

@frankfarrell Any thoughts on this?

@schwartzmx
Copy link
Copy Markdown

Also just ran into this issue

Stack trace from the terraform-provider-redshift_v0.0.3 plugin:

panic: strconv.Atoi: parsing "": invalid syntax

goroutine 27 [running]:
github.com/frankfarrell/terraform-provider-redshift/redshift.readRedshiftGroup(0xc00024d810, 0xc000480c00, 0xc000128000, 0x0)
        /build/redshift/resource_redshift_group.go:151 +0x5d7
github.com/frankfarrell/terraform-provider-redshift/redshift.resourceRedshiftGroupRead(0xc00024d810, 0xd1b960, 0xc00024ddc0, 0xc00024d810, 0x0)
        /build/redshift/resource_redshift_group.go:116 +0x9e
github.com/hashicorp/terraform/helper/schema.(*Resource).RefreshWithoutUpgrade(0xc000196a00, 0xc0005cdb80, 0xd1b960, 0xc00024ddc0, 0xc0001f0030, 0xc0005cdb80, 0x0)
        /go/pkg/mod/github.com/hashicorp/terraform@v0.12.2/helper/schema/resource.go:447 +0x12e
github.com/hashicorp/terraform/helper/plugin.(*GRPCProviderServer).ReadResource(0xc00013ca48, 0xfea5d0, 0xc0005ffd40, 0xc0005cda90, 0xc00013ca48, 0xc0005ffd40, 0xc0001d9a50)
        /go/pkg/mod/github.com/hashicorp/terraform@v0.12.2/helper/plugin/grpc_provider.go:499 +0x332
github.com/hashicorp/terraform/internal/tfplugin5._Provider_ReadResource_Handler(0xe561c0, 0xc00013ca48, 0xfea5d0, 0xc0005ffd40, 0xc0005cda40, 0x0, 0xfea5d0, 0xc0005ffd40, 0xc000316230, 0x43)
        /go/pkg/mod/github.com/hashicorp/terraform@v0.12.2/internal/tfplugin5/tfplugin5.pb.go:3181 +0x214
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000304900, 0xff20d8, 0xc000001e00, 0xc0001bf100, 0xc00030e5d0, 0x14bc830, 0x0, 0x0, 0x0)
        /go/pkg/mod/google.golang.org/grpc@v1.18.0/server.go:966 +0x486
google.golang.org/grpc.(*Server).handleStream(0xc000304900, 0xff20d8, 0xc000001e00, 0xc0001bf100, 0x0)
        /go/pkg/mod/google.golang.org/grpc@v1.18.0/server.go:1245 +0xcbd
google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc000038240, 0xc000304900, 0xff20d8, 0xc000001e00, 0xc0001bf100)
        /go/pkg/mod/google.golang.org/grpc@v1.18.0/server.go:685 +0xab
created by google.golang.org/grpc.(*Server).serveStreams.func1
        /go/pkg/mod/google.golang.org/grpc@v1.18.0/server.go:683 +0xa5

Error: The terraform-provider-redshift_v0.0.3 plugin crashed!

was able to work around it by manually re-adding some things back on the redshift side to alleviate the panic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants