segmentio / terraform-provider-segment

Terraform provider for Segment, using the Public API
https://registry.terraform.io/providers/segmentio/segment/latest
MIT License
25 stars 3 forks source link

Crash when creating a resource from import block #58

Closed sco-at-scg closed 9 months ago

sco-at-scg commented 9 months ago

Description

Please re open issue:

https://github.com/segmentio/terraform-provider-segment/issues/52

When importing destination: Google Analytics 4 with v0.2.0

Stack trace from the terraform-provider-segment_v0.2.0 plugin:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x8 pc=0x103389a00]

goroutine 241 [running]:
github.com/segmentio/terraform-provider-segment/internal/provider/models.(*DestinationMetadataState).getContacts(0x103969100?, {0x1400068c1e0?, 0x1, 0x140001883c0?})
        github.com/segmentio/terraform-provider-segment/internal/provider/models/destination_metadata.go:240 +0xb0
github.com/segmentio/terraform-provider-segment/internal/provider/models.(*DestinationMetadataState).Fill(_, {{0x14000814300, 0x18}, {0x14000814330, 0x16}, {0x14000334280, 0x264}, {0x140007f00a0, 0x1e}, {{0x14000430180, ...}, ...}, ...})
        github.com/segmentio/terraform-provider-segment/internal/provider/models/destination_metadata.go:412 +0x280
github.com/segmentio/terraform-provider-segment/internal/provider/models.(*DestinationState).Fill(0x140002ec000, 0x1400086cfe0)
        github.com/segmentio/terraform-provider-segment/internal/provider/models/destination.go:31 +0x7c
github.com/segmentio/terraform-provider-segment/internal/provider.(*destinationResource).Read(0x14000756840, {0x1039bb0a0, 0x140007d1020}, {{{{0x1039bf498, 0x140005c0450}, {0x103889f40, 0x1400082ff80}}, {0x1039c1e98, 0x140000ca050}}, 0x140001fc068, ...}, ...)
        github.com/segmentio/terraform-provider-segment/internal/provider/destination_resource.go:600 +0x338
github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(*Server).ReadResource(0x14000175a20, {0x1039bb0a0, 0x140007d1020}, 0x140007d10b0, 0x1400086d5e0)
        github.com/hashicorp/terraform-plugin-framework@v1.4.1/internal/fwserver/server_readresource.go:101 +0x4a4
github.com/hashicorp/terraform-plugin-framework/internal/proto6server.(*Server).ReadResource(0x14000175a20, {0x1039bb0a0?, 0x140007d0ed0?}, 0x14000616cc0)
        github.com/hashicorp/terraform-plugin-framework@v1.4.1/internal/proto6server/server_readresource.go:55 +0x1a4
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ReadResource(0x14000272640, {0x1039bb0a0?, 0x140007d0750?}, 0x140003dcba0)
        github.com/hashicorp/terraform-plugin-go@v0.19.0/tfprotov6/tf6server/server.go:787 +0x3e8
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ReadResource_Handler({0x10397b920?, 0x14000272640}, {0x1039bb0a0, 0x140007d0750}, 0x140009c4310, 0x0)
        github.com/hashicorp/terraform-plugin-go@v0.19.0/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:431 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0x1400026c1e0, {0x1039c0558, 0x140003c4d00}, 0x14000833440, 0x140003c6000, 0x103f8b448, 0x0)
        google.golang.org/grpc@v1.57.0/server.go:1360 +0xc88
google.golang.org/grpc.(*Server).handleStream(0x1400026c1e0, {0x1039c0558, 0x140003c4d00}, 0x14000833440, 0x0)
        google.golang.org/grpc@v1.57.0/server.go:1737 +0x82c
google.golang.org/grpc.(*Server).serveStreams.func1.1()
        google.golang.org/grpc@v1.57.0/server.go:982 +0x84
created by google.golang.org/grpc.(*Server).serveStreams.func1
        google.golang.org/grpc@v1.57.0/server.go:980 +0x16c

Error: The terraform-provider-segment_v0.2.0 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.
deanhuynh commented 9 months ago

Fixed in v0.3.0, let me know if you are still having trouble.