Terraform Gitlab provider 17.2 and 17.3 panic: runtime error: invalid memory address or nil pointer dereference
Bug Report
I upgrade a terraform code with the latest version of Gitlab provider. The 17.2 and 17.3 crash. It's ok with previous version 16.11 and 17.1.
Relevant Terraform Configuration
The terraform contains multiples groups, projects and membership creation. We recently upgrade the "group" and "project" to replace the deprecated emails_disabled by emails_enabled.
Relevant Log Output
`Planning failed. Terraform encountered an error while generating this plan.
╷ │ Error: Request cancelled │ │ The plugin6.(*GRPCProvider).UpgradeResourceState request was cancelled. ╵ ╷ │ Error: Request cancelled │ │ The plugin6.(*GRPCProvider).UpgradeResourceState request was cancelled. ╵ ╷ │ Error: Plugin did not respond │ │ The plugin encountered an error, and failed to respond to the plugin6.(*GRPCProvider).ReadResource call. The plugin logs may contain more details. ╵ ╷ │ Error: Plugin did not respond │ │ The plugin encountered an error, and failed to respond to the plugin6.(*GRPCProvider).ReadResource call. The plugin logs may contain more details. ╵ ╷ │ Error: Request cancelled │ │ The plugin6.(*GRPCProvider).UpgradeResourceState request was cancelled. ╵ ╷ │ Error: Request cancelled │ │ The plugin6.(*GRPCProvider).UpgradeResourceState request was cancelled. ╵
Stack trace from the terraform-provider-gitlab_v17.2.0 plugin:
panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xe19f58]
goroutine 60 [running]: gitlab.com/gitlab-org/terraform-provider-gitlab/internal/provider.(*gitlabPersonalAccessTokenResource).personalAccessTokenToStateModel(0xc0005a4438?, 0xc0006666e0, 0xc0002153b0, 0x1?) gitlab.com/gitlab-org/terraform-provider-gitlab/internal/provider/resource_gitlab_personal_access_token.go:161 +0x58 gitlab.com/gitlab-org/terraform-provider-gitlab/internal/provider.(*gitlabPersonalAccessTokenResource).Read(0xc00061e9d8, {0x12c5428, 0xc000532690}, {{{{0x12cb040, 0xc000544420}, {0xf4caa0, 0xc000544150}}, {0x12cd5b0, 0xc00016cc30}}, 0xc00061e9e8, ...}, ...) gitlab.com/gitlab-org/terraform-provider-gitlab/internal/provider/resource_gitlab_personal_access_token.go:244 +0x7ff github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(*Server).ReadResource(0xc0002701e0, {0x12c5428, 0xc000532690}, 0xc0005326f0, 0xc000817620) github.com/hashicorp/terraform-plugin-framework@v1.10.0/internal/fwserver/server_readresource.go:117 +0x84e github.com/hashicorp/terraform-plugin-framework/internal/proto6server.(*Server).ReadResource(0xc0002701e0, {0x12c5428?, 0xc0005325a0?}, 0xc000a82900) github.com/hashicorp/terraform-plugin-framework@v1.10.0/internal/proto6server/server_readresource.go:55 +0x38e github.com/hashicorp/terraform-plugin-mux/tf6muxserver.(*muxServer).ReadResource(0xc000279880, {0x12c5428?, 0xc0005322d0?}, 0xc000a82900) github.com/hashicorp/terraform-plugin-mux@v0.16.0/tf6muxserver/mux_server_ReadResource.go:35 +0x193 github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ReadResource(0xc000273ae0, {0x12c5428?, 0xc000767a70?}, 0xc000279570) github.com/hashicorp/terraform-plugin-go@v0.23.0/tfprotov6/tf6server/server.go:784 +0x309 github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ReadResource_Handler({0x10a6f80, 0xc000273ae0}, {0x12c5428, 0xc000767a70}, 0xc000493800, 0x0) github.com/hashicorp/terraform-plugin-go@v0.23.0/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:482 +0x1a6 google.golang.org/grpc.(*Server).processUnaryRPC(0xc000195000, {0x12c5428, 0xc0007679e0}, {0x12cbf60, 0xc00022a480}, 0xc000170000, 0xc000483350, 0x1984e08, 0x0) google.golang.org/grpc@v1.63.2/server.go:1369 +0xdf8 google.golang.org/grpc.(*Server).handleStream(0xc000195000, {0x12cbf60, 0xc00022a480}, 0xc000170000) google.golang.org/grpc@v1.63.2/server.go:1780 +0xe8b google.golang.org/grpc.(*Server).serveStreams.func2.1() google.golang.org/grpc@v1.63.2/server.go:1019 +0x8b created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 53 google.golang.org/grpc@v1.63.2/server.go:1030 +0x125
Error: The terraform-provider-gitlab_v17.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. `
Other logs
The TF_LOG contains 37013 lines. It will take me a while to sanitize it. I'll wait to see if it's required.
Additional Details
- GitLab Terraform Provider Version:
17.2
- GitLab Version:
15.2
- Terraform Version:
1.9.5