Crash when creating pipeline schedule without sufficient access
Bug Report
Terraform provider segmentation violation error during apply phase when creating a new GitLab pipeline schedule.
Relevant Terraform Configuration
resource "gitlab_pipeline_schedule" "example" {
project = "12345"
description = "Used to schedule builds"
ref = "master"
cron = "0 1 * * *"
}
The current user (token) has no permission to create or run schedules (no merge request merge permission) on 12345 project.
Relevant Terraform Command
terraform apply
Relevant Log Output
These are the debug logs of the terraform command output:
terraform command output:╷
│ Error: Plugin did not respond
│
│ The plugin encountered an error, and failed to respond to the
│ plugin6.(*GRPCProvider).ApplyResourceChange call. The plugin logs may
│ contain more details.
╵
Stack trace from the terraform-provider-gitlab_v16.10.0 plugin:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xdfc9e6]
goroutine 120 [running]:
gitlab.com/gitlab-org/terraform-provider-gitlab/internal/provider.(*gitlabPipelineScheduleResource).Create(0xc000826088, {0x1267818, 0xc000a9dcb0}, {{{{0x126d260, 0xc000ab48d0}, {0xf0e760, 0xc000ab47b0}}, {0x126f2b8, 0xc00007eeb0}}, {{{0x126d260, ...}, ...}, ...}, ...}, ...)
gitlab.com/gitlab-org/terraform-provider-gitlab/internal/provider/resource_gitlab_pipeline_schedule.go:453 +0x626
github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(*Server).CreateResource(0xc000382820, {0x1267818, 0xc000a9dcb0}, 0xc000abf540, 0xc000abf518)
github.com/hashicorp/terraform-plugin-framework@v1.6.1/internal/fwserver/server_createresource.go:101 +0x578
github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(*Server).ApplyResourceChange(0xc000382820, {0x1267818, 0xc000a9dcb0}, 0xc000853a40, 0xc000abf630)
github.com/hashicorp/terraform-plugin-framework@v1.6.1/internal/fwserver/server_applyresourcechange.go:57 +0x4aa
github.com/hashicorp/terraform-plugin-framework/internal/proto6server.(*Server).ApplyResourceChange(0xc000382820, {0x1267818?, 0xc000a9dbc0?}, 0xc0008539a0)
github.com/hashicorp/terraform-plugin-framework@v1.6.1/internal/proto6server/server_applyresourcechange.go:55 +0x38e
github.com/hashicorp/terraform-plugin-mux/tf6muxserver.(*muxServer).ApplyResourceChange(0xc000239180, {0x1267818?, 0xc000a9d8f0?}, 0xc0008539a0)
github.com/hashicorp/terraform-plugin-mux@v0.15.0/tf6muxserver/mux_server_ApplyResourceChange.go:36 +0x193
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ApplyResourceChange(0xc000237860, {0x1267818?, 0xc000850900?}, 0xc0001cc460)
github.com/hashicorp/terraform-plugin-go@v0.22.1/tfprotov6/tf6server/server.go:846 +0x3d0
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ApplyResourceChange_Handler({0x105d260, 0xc000237860}, {0x1267818, 0xc000850900}, 0xc00084a480, 0x0)
github.com/hashicorp/terraform-plugin-go@v0.22.1/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:518 +0x1a6
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0000f1a00, {0x1267818, 0xc000850870}, {0x126dda0, 0xc000382000}, 0xc0009b37a0, 0xc00043ccc0, 0x19153b8, 0x0)
google.golang.org/grpc@v1.62.1/server.go:1386 +0xdf8
google.golang.org/grpc.(*Server).handleStream(0xc0000f1a00, {0x126dda0, 0xc000382000}, 0xc0009b37a0)
google.golang.org/grpc@v1.62.1/server.go:1797 +0xe87
google.golang.org/grpc.(*Server).serveStreams.func2.1()
google.golang.org/grpc@v1.62.1/server.go:1027 +0x8b
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 12
google.golang.org/grpc@v1.62.1/server.go:1038 +0x125
Error: The terraform-provider-gitlab_v16.10.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.
Additional Details
- GitLab Terraform Provider Version:
16.10.0 - GitLab Version:
16.8.5-ee - Terraform Version:
1.7.2
When creating a new schedule without sufficient permission to do so (403 Forbidden API response), the provider reads ID property of pipelineSchedule object that is nil in the error handling path:
A recently fixed issue with updating existing schedules is similar to this problem: