Skip to content

[BUG]: v6.7.5 SIGSEGV when reading resource github_organization_ruleset #2872

Closed

Description

@ironstar94

Expected Behavior

When running terraform plan or apply, the resource github_organization_ruleset should get read properly

Actual Behavior

Terraform plugin crashes when trying to read github_organization_ruleset

The bug with github_organization_ruleset has supposedly been solved with #2542

But it appears that the resource is bugged in v6.7.5, now with a different cause for the crash

Terraform Version

Terraform 1.12.2 on on linux_amd64

Affected Resource(s)

  • github_organization_ruleset

Terraform Configuration Files

Steps to Reproduce

terraform plan

Debug Output

│ Error: Plugin did not respond
│ 
│   with github_organization_ruleset.pr_check,
│   on _global.tf line 7, in resource "github_organization_ruleset" "pr_check":
│    7: resource "github_organization_ruleset" "pr_check" {
│ 
│ The plugin encountered an error, and failed to respond to the
│ plugin.(*GRPCProvider).ReadResource call. The plugin logs may contain more
│ details.

Panic Output

Stack trace from the terraform-provider-github_v6.7.5 plugin:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0xc7612d]
goroutine 596 [running]:
github.com/integrations/terraform-provider-github/v6/github.resourceGithubOrganizationRulesetRead(0xc00031d880, {0xd43240?, 0xc000263500?})
	github.com/integrations/terraform-provider-github/v6/github/resource_github_organization_ruleset.go:572 +0x56d
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0x108e0d0?, {0x108e0d0?, 0xc000884900?}, 0xd?, {0xd43240?, 0xc000263500?})
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:811 +0x15f
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).RefreshWithoutUpgrade(0xc00039b180, {0x108e0d0, 0xc000884900}, 0xc00067af70, {0xd43240, 0xc000263500})
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:1117 +0x529
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadResource(0xc0002e8690, {0x108e0d0?, 0xc000884840?}, 0xc0006e1440)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:708 +0x6c5
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ReadResource(0xc0001e7900, {0x108e0d0?, 0xc0006ebf20?}, 0xc00097c000)
	github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:783 +0x309
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadResource_Handler({0xeef4c0, 0xc0001e7900}, {0x108e0d0, 0xc0006ebf20}, 0xc00031cd80, 0x0)
	github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:482 +0x1a6
google.golang.org/grpc.(*Server).processUnaryRPC(0xc00010b000, {0x108e0d0, 0xc0006ebe90}, {0x10929c8, 0xc0001f6300}, 0xc000978b40, 0xc00044ef90, 0x1731528, 0x0)
	google.golang.org/[email protected]/server.go:1369 +0xdf8
google.golang.org/grpc.(*Server).handleStream(0xc00010b000, {0x10929c8, 0xc0001f6300}, 0xc000978b40)
	google.golang.org/[email protected]/server.go:1780 +0xe8b
google.golang.org/grpc.(*Server).serveStreams.func2.1()
	google.golang.org/[email protected]/server.go:1019 +0x8b
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 12
	google.golang.org/[email protected]/server.go:1030 +0x125
Error: The terraform-provider-github_v6.7.5 plugin crashed!

Code of Conduct

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

Activity

  1. added
    Type: Bug
    Status: Triage
    on Nov 7, 2025
  2. changed the title [-][BUG]: v6.7.5 SIGSEGV when reading resource github_organization_ruleset in terrafrom plan[/-] [+][BUG]: v6.7.5 SIGSEGV when reading resource github_organization_ruleset[/+] on Nov 7, 2025
  3. lborruto commented on Nov 7, 2025

    @lborruto

    fyi; same issue on my side, but on v6.0.0 (Terraform v1.13.5):

    │ Error: Plugin did not respond
    │ 
    │   with github_organization_ruleset.main_branch_protection,
    │   on github_organization_rulesets.tf line 18, in resource "github_organization_ruleset" "main_branch_protection":
    │   18: resource "github_organization_ruleset" "main_branch_protection" {
    │ 
    │ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ReadResource call. The plugin logs may contain more details.
    
    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=0x2 addr=0x8 pc=0x102a2d6cc]
    
    goroutine 51 [running]:
    github.com/integrations/terraform-provider-github/v6/github.resourceGithubOrganizationRulesetRead(0x1400009e700, {0x102c44560?, 0x1400023e300?})
            github.com/integrations/terraform-provider-github/v6/github/resource_github_organization_ruleset.go:525 +0x4bc
    github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0x102e28ce0?, {0x102e28ce0?, 0x140003f47e0?}, 0xd?, {0x102c44560?, 0x1400023e300?})
            github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:783 +0x130
    github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).RefreshWithoutUpgrade(0x1400041c000, {0x102e28ce0, 0x140003f47e0}, 0x140004d7930, {0x102c44560, 0x1400023e300})
            github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:1089 +0x408
    github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadResource(0x1400035ff38, {0x102e28ce0?, 0x140003f4720?}, 0x1400023e1c0)
            github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:663 +0x3e4
    github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ReadResource(0x1400025d5e0, {0x102e28ce0?, 0x14000219bc0?}, 0x14000484480)
            github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:789 +0x394
    github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadResource_Handler({0x102ddfec0, 0x1400025d5e0}, {0x102e28ce0, 0x14000219bc0}, 0x1400009e100, 0x0)
            github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:467 +0x1c0
    google.golang.org/grpc.(*Server).processUnaryRPC(0x140002561e0, {0x102e28ce0, 0x14000218d80}, {0x102e2d4f8, 0x14000405520}, 0x14000000480, 0x140004c8b10, 0x10347b668, 0x0)
            google.golang.org/[email protected]/server.go:1372 +0xb40
    google.golang.org/grpc.(*Server).handleStream(0x140002561e0, {0x102e2d4f8, 0x14000405520}, 0x14000000480)
            google.golang.org/[email protected]/server.go:1783 +0xc00
    google.golang.org/grpc.(*Server).serveStreams.func2.1()
            google.golang.org/[email protected]/server.go:1016 +0x5c
    created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 11
            google.golang.org/[email protected]/server.go:1027 +0x124
    
    Error: The terraform-provider-github_v6.0.0 plugin crashed!
    
  4. lborruto commented on Nov 13, 2025

    @lborruto

    @ironstar94 I found a fix — I deleted all mentions of github_organization_ruleset from my tfstate, manually deleted the ruleset on GitHub, and then ran a new apply.

  5. ironstar94 commented on Nov 13, 2025

    @ironstar94
    Author

    @lborruto That crashes on the next run when it tries a refresh

  6. lborruto commented on Nov 13, 2025

    @lborruto

    @lborruto That crashes on the next run when it tries a refresh

    Can I have a look at your terraform code for github_organization_ruleset?

  7. stevehipwell commented on Nov 13, 2025

    @stevehipwell
    Collaborator

    Could you get the ruleset out of the REST API and post it here so we can figure out why it can't be read?

  8. ironstar94 commented on Nov 14, 2025

    @ironstar94
    Author

    Could you get the ruleset out of the REST API and post it here so we can figure out why it can't be read?

      "id": 1111111,
      "name": "Ruleset Name",
      "target": "branch",
      "source_type": "Organization",
      "source": "org",
      "enforcement": "active",
      "conditions": {
        "ref_name": {
          "exclude": [],
          "include": [
            "~DEFAULT_BRANCH"
          ]
        },
        "repository_name": {
          "exclude": [],
          "include": [
            "~ALL"
          ],
          "protected": false
        }
      },
      "rules": [
        {
          "type": "required_status_checks",
          "parameters": {
            "strict_required_status_checks_policy": false,
            "do_not_enforce_on_create": false,
            "required_status_checks": [
              {
                "context": "Check Title",
                "integration_id": 111111
              }
            ]
          }
        }
      ],
      "node_id": "xxxxxxx",
      "created_at": "2025-11-06T21:55:15.738+01:00",
      "updated_at": "2025-11-11T19:30:47.263+01:00",
      "bypass_actors": [
        {
          "actor_id": xxxxx,
          "actor_type": "Integration",
          "bypass_mode": "always"
        },
        {
          "actor_id": xxxxx,
          "actor_type": "Team",
          "bypass_mode": "always"
        }
      ],
      "_links": {
        "self": {
          "href": "https://api.github.com/orgs/xxxx/rulesets/1111111"
        },
        "html": {
          "href": "http://github.com/organizations/xxxx/settings/rules/1111111"
        }
      }
    }```
    
  9. stevehipwell commented on Nov 14, 2025

    @stevehipwell
    Collaborator

    @ironstar94 what does your TF configuration look like?

  10. stevehipwell commented on Nov 14, 2025

    @stevehipwell
    Collaborator

    @ironstar94 and when was the last time this worked if ever? It'd also be useful to know which provider version was used to create the resource?

  11. ironstar94 commented on Nov 14, 2025

    @ironstar94
    Author

    @ironstar94 what does your TF configuration look like?

    Sorry, should have included with the other one

    resource "github_organization_ruleset" "this" {
      name        = "Ruleset Name"
      enforcement = "active"
      target      = "branch"
      rules {
        required_status_checks {
          required_check {
            context        = "Ruleset Name"
            integration_id = "xxxxx"
          }
        }
      }
    
      bypass_actors {
        actor_type = "Integration"
        actor_id   = "xxxxxx"
        bypass_mode = "bypass"
      }
    
      bypass_actors {
        actor_type = "Team"
        actor_id   = "xxxxx"
        bypass_mode = "bypass"
      }
    
      conditions {
        ref_name {
          exclude = []
          include = [
            "~DEFAULT_BRANCH"
          ]
        }
        repository_name {
          exclude = []
          include = [
            "~ALL"
          ]
        }
      }
    }
    
    
  12. ironstar94 commented on Nov 14, 2025

    @ironstar94
    Author

    @ironstar94 and when was the last time this worked if ever? It'd also be useful to know which provider version was used to create the resource?

    We saw this crashing immediately with v6.7.5. We tried creating it with v6.4.0 and that worked, but moving back to v6.7.5 results in SIGSEGV.

  13. stevehipwell commented on Nov 14, 2025

    @stevehipwell
    Collaborator

    @ironstar94 your bypass mode looks invalid?

    It looks like you may be able to add the do_not_enforce_on_create value to the required_status_checks?

    If the above doesn't work you might be able to use a remove block followed by an import block to re import this resource without issue.

  14. removed
    Status: Triage
    on Jan 15, 2026
  15. stevehipwell commented on Jan 15, 2026

    @stevehipwell
    Collaborator

    @ironstar94 could you please check if this is still an issue with the latest provider version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: Bug

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions