Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug Fix, Empty Group #42

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

samatspothero
Copy link
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
Contributor Author

@frankfarrell Any thoughts on this?

@schwartzmx
Copy link

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