terraform-provider-github icon indicating copy to clipboard operation
terraform-provider-github copied to clipboard

[BUG]: Runtime panic in terraform-provider-github_v6.0.0 during github_repository_deployment_branch_policy resource creation

Open imperius361 opened this issue 11 months ago • 4 comments

Expected Behavior

The github_repository_deployment_branch_policy resource should be created without errors when applying the Terraform configuration.

Actual Behavior

When attempting to create a github_repository_deployment_branch_policy resource, the terraform-provider-github plugin v6.0.0 crashes with a runtime error indicating an invalid memory address or nil pointer dereference. This results in a failed Terraform apply operation.

Terraform Version

Terraform v1.4.5 on linux_amd64 + provider registry.terraform.io/integrations/github v6.0.0

Affected Resource(s)

github_repository_deployment_branch_policy

Terraform Configuration Files

resource "github_repository_environment" "dev" {
  repository = github_repository.repository.name
  environment = "dev"
  deployment_branch_policy {
    protected_branches = false
    custom_branch_policies = true
  }
}

resource "github_repository_deployment_branch_policy" "dev" {
  for_each = toset(["dev", "hotfix/*", "feature/*"])
  depends_on = [ github_repository_environment.dev ]
  repository = github_repository.repository.name
  environment_name = "dev"
  name = each.value
}

Steps to Reproduce

terraform apply with a configuration that includes a github_repository_deployment_branch_policy resource.

Debug Output

No response

Panic Output

Stack trace from the terraform-provider-github_v6.0.0 plugin:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xc76ddd]

goroutine 118 [running]:
github.com/integrations/terraform-provider-github/v6/github.resourceGithubRepositoryDeploymentBranchPolicyCreate(0xc0005a2b80, {0xd0dfe0, 0xc000644900})
github.com/integrations/terraform-provider-github/v6/github/resource_github_repository_deployment_branch_policy.go:88 +0x2fd
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0x103f160?, {0x103f160?, 0xc000463f50?}, 0xd?, {0xd0dfe0?, 0xc000644900?})
github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:766 +0x15f
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc0003b5340, {0x103f160, 0xc000463f50}, 0xc000666410, 0xc000739700, {0xd0dfe0, 0xc000644900})
github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:909 +0xa89
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc000379e90, {0x103f160?, 0xc0007c9cb0?}, 0xc0007a3c20)
github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:1074 +0xd5c
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc000269680, {0x103f160?, 0xc0007c92f0?}, 0xc000660770)
github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:859 +0x56f
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0xea58c0, 0xc000269680}, {0x103f160, 0xc0007c92f0}, 0xc0007d6100, 0x0)
github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:503 +0x1a6
google.golang.org/grpc.(*Server).processUnaryRPC(0xc00025e1e0, {0x103f160, 0xc0007c9230}, {0x10439b8, 0xc0003a9380}, 0xc000906240, 0xc000462ae0, 0x16b1498, 0x0)
google.golang.org/[email protected]/server.go:1372 +0xdd1
google.golang.org/grpc.(*Server).handleStream(0xc00025e1e0, {0x10439b8, 0xc0003a9380}, 0xc000906240)
google.golang.org/[email protected]/server.go:1783 +0xfb8
google.golang.org/grpc.(*Server).serveStreams.func2.1()
google.golang.org/[email protected]/server.go:1016 +0x59
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 9
google.golang.org/[email protected]/server.go:1027 +0x106

Error: The terraform-provider-github_v6.0.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.

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

imperius361 avatar Mar 04 '24 10:03 imperius361