Skip to content

[BUG]: resource_github_organization_ruleset crashes #2597

Closed

Description

@zemirco

Expected Behavior

I'm using the latest release and since then terraform plan as well as terraform apply crash.

Actual Behavior

I don't know if it's related to the terraform GitHub provider or if it is an issue with the underlying Go GitHub packages.

Below you can see the error message that I'm getting.

Terraform Version

Terraform v1.10.5
on linux_amd64

  • provider registry.terraform.io/integrations/github v6.6.0

Affected Resource(s)

  • github_organization_ruleset

Terraform Configuration Files

Steps to Reproduce

$ terraform apply

Debug Output

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

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

goroutine 44 [running]:
github.com/integrations/terraform-provider-github/v6/github.resourceGithubOrganizationRulesetRead(0xc00059c000, {0xd352c0?, 0xc000380840?})
        github.com/integrations/terraform-provider-github/v6/github/resource_github_organization_ruleset.go:560 +0x56d
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0x107d470?, {0x107d470?, 0xc0008dc840?}, 0xd?, {0xd352c0?, 0xc000380840?})
        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(0xc0003bbdc0, {0x107d470, 0xc0008dc840}, 0xc000991ad0, {0xd352c0, 0xc000380840})
        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(0xc000141d58, {0x107d470?, 0xc0008dc780?}, 0xc00084aa80)
        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(0xc0001646e0, {0x107d470?, 0xc0008c7f20?}, 0xc00022c2a0)
        github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:783 +0x309
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadResource_Handler({0xee16c0, 0xc0001646e0}, {0x107d470, 0xc0008c7f20}, 0xc00078ed00, 0x0)
        github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:482 +0x1a6
google.golang.org/grpc.(*Server).processUnaryRPC(0xc00039c000, {0x107d470, 0xc0008c7e90}, {0x1081d68, 0xc00027e300}, 0xc0008d0900, 0xc000463890, 0x1719528, 0x0)
        google.golang.org/[email protected]/server.go:1369 +0xdf8
google.golang.org/grpc.(*Server).handleStream(0xc00039c000, {0x1081d68, 0xc00027e300}, 0xc0008d0900)
        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 25
        google.golang.org/[email protected]/server.go:1030 +0x125

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

Panic Output

Code of Conduct

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

Activity

  1. added
    Status: Triage
    Type: Bug
    on Mar 18, 2025
  2. ricoli-motorway commented on Apr 1, 2025

    @ricoli-motorway

    I experienced the same crash and the cause ended up being an expired Github token.

  3. zemirco commented on Apr 3, 2025

    @zemirco
    Author

    I checked again and used a fresh GitHub token. I'm still seeing the same problem.

  4. johnszen commented on Apr 22, 2025

    @johnszen

    I encounter the same.

    Error as follow:

    github_organization_ruleset.protect_default_branches: Creating...
    ╷
    │ Error: Plugin did not respond
    │ 
    │   with github_organization_ruleset.protect_default_branches,
    │   on main.tf line 98, in resource "github_organization_ruleset" "protect_default_branches":
    │   98: resource "github_organization_ruleset" "protect_default_branches" {
    │ 
    │ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin
    │ logs may contain more details.
    ╵
    
    Stack trace from the terraform-provider-github_v6.6.0 plugin:
    
    panic: interface conversion: interface {} is nil, not bool
    
    goroutine 102 [running]:
    github.com/integrations/terraform-provider-github/v6/github.expandRules({0x4000527930?, 0xa86009?, 0x0?}, 0x1)
            github.com/integrations/terraform-provider-github/v6/github/respository_rules_utils.go:343 +0x25a0
    github.com/integrations/terraform-provider-github/v6/github.resourceGithubRulesetObject(0x4000233100, {0x4000158750, 0x13})
            github.com/integrations/terraform-provider-github/v6/github/respository_rules_utils.go:33 +0x274
    github.com/integrations/terraform-provider-github/v6/github.resourceGithubOrganizationRulesetCreate(0x4000233100, {0x8a0240, 0x40005953c0})
            github.com/integrations/terraform-provider-github/v6/github/resource_github_organization_ruleset.go:511 +0x5c
    github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0xbe8330?, {0xbe8330?, 0x40004331d0?}, 0xd?, {0x8a0240?, 0x40005953c0?})
            github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:794 +0x130
    github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0x40003fe0e0, {0xbe8330, 0x40004331d0}, 0x4000435930, 0x4000232f80, {0x8a0240, 0x40005953c0})
            github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:937 +0x884
    github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0x40005aa000, {0xbe8330?, 0x4000433110?}, 0x400025edc0)
            github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:1153 +0xaa4
    github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0x40005b0000, {0xbe8330?, 0x4000432750?}, 0x40000c9110)
            github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:865 +0x2b4
    github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0xa4c1a0, 0x40005b0000}, {0xbe8330, 0x4000432750}, 0x4000232380, 0x0)
            github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:518 +0x1c0
    google.golang.org/grpc.(*Server).processUnaryRPC(0x40002a2200, {0xbe8330, 0x40004326c0}, {0xbecc68, 0x40001be180}, 0x400041d560, 0x4000586540, 0x12695b8, 0x0)
            google.golang.org/[email protected]/server.go:1369 +0xb58
    google.golang.org/grpc.(*Server).handleStream(0x40002a2200, {0xbecc68, 0x40001be180}, 0x400041d560)
            google.golang.org/[email protected]/server.go:1780 +0xb20
    google.golang.org/grpc.(*Server).serveStreams.func2.1()
            google.golang.org/[email protected]/server.go:1019 +0x8c
    created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 14
            google.golang.org/[email protected]/server.go:1030 +0x13c
    
    Error: The terraform-provider-github_v6.6.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.
    
  5. CpuID commented on Apr 28, 2025

    @CpuID

    I encountered a different crash to the original filed, but the same as #2597 (comment)

    github_organization_ruleset.platform_eng: Creating...
    ╷
    │ Error: Plugin did not respond
    │
    │   with github_organization_ruleset.platform_eng,
    │   on ruleset.tf line 6, in resource "github_organization_ruleset" "platform_eng":
    │    6: resource "github_organization_ruleset" "platform_eng" {
    │
    │ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details.
    ╵
    
    Stack trace from the terraform-provider-github_v6.6.0 plugin:
    
    panic: interface conversion: interface {} is nil, not bool
    
    goroutine 97 [running]:
    github.com/integrations/terraform-provider-github/v6/github.expandRules({0x140000ef080?, 0x1015cec13?, 0x0?}, 0x1)
    	github.com/integrations/terraform-provider-github/v6/github/respository_rules_utils.go:343 +0x25a0
    github.com/integrations/terraform-provider-github/v6/github.resourceGithubRulesetObject(0x14000533700, {0x140005422f0, 0x8})
    	github.com/integrations/terraform-provider-github/v6/github/respository_rules_utils.go:33 +0x274
    github.com/integrations/terraform-provider-github/v6/github.resourceGithubOrganizationRulesetCreate(0x14000533700, {0x101794840, 0x1400036e080})
    	github.com/integrations/terraform-provider-github/v6/github/resource_github_organization_ruleset.go:511 +0x5c
    github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0x10198b9b0?, {0x10198b9b0?, 0x14000806db0?}, 0xd?, {0x101794840?, 0x1400036e080?})
    	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:794 +0x130
    github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0x14000424c40, {0x10198b9b0, 0x14000806db0}, 0x14000588410, 0x14000533580, {0x101794840, 0x1400036e080})
    	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:937 +0x884
    github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0x140003f86f0, {0x10198b9b0?, 0x14000806cf0?}, 0x140006463c0)
    	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:1153 +0xaa4
    github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0x140002b59a0, {0x10198b9b0?, 0x14000806300?}, 0x140002a0000)
    	github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:865 +0x2b4
    github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x101944ca0, 0x140002b59a0}, {0x10198b9b0, 0x14000806300}, 0x14000532000, 0x0)
    	github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:518 +0x1c0
    google.golang.org/grpc.(*Server).processUnaryRPC(0x1400021f000, {0x10198b9b0, 0x14000806270}, {0x101990268, 0x14000354180}, 0x1400035a000, 0x1400056aae0, 0x102001738, 0x0)
    	google.golang.org/[email protected]/server.go:1369 +0xb58
    google.golang.org/grpc.(*Server).handleStream(0x1400021f000, {0x101990268, 0x14000354180}, 0x1400035a000)
    	google.golang.org/[email protected]/server.go:1780 +0xb20
    google.golang.org/grpc.(*Server).serveStreams.func2.1()
    	google.golang.org/[email protected]/server.go:1019 +0x8c
    created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 8
    	google.golang.org/[email protected]/server.go:1030 +0x13c
    
    Error: The terraform-provider-github_v6.6.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.
    

    HCL to repro this:

    resource "github_organization_ruleset" "team_name" {
      name = "Team Name"
      target = "branch"
      enforcement = "evaluate"
    
      conditions {
        repository_name {
          include = [
            "someorgrepo"
          ]
          exclude = []
        }
    
        ref_name {
          include = ["~DEFAULT_BRANCH"]
          exclude = []
        }
      }
    
      rules {
        deletion = true
        non_fast_forward = true
    
        pull_request {
          dismiss_stale_reviews_on_push = true
          require_code_owner_review = true
          require_last_push_approval = true
          required_approving_review_count = 1
        }
    
        required_status_checks {
          strict_required_status_checks_policy = true
    
          required_check {
            context = "Run Checks and Comment"
          }
        }
      }
    }
    
  6. nenosrep commented on May 22, 2025

    @nenosrep
    Contributor

    Hey all
    Made a PR today to fix the 'panic: interface conversion: interface {} is nil, not bool' issue.
    #2667
    That will also add the option to be usable on org rulesets :)

  7. maeghan-porter commented on May 22, 2025

    @maeghan-porter

    I'm also coming across this. I hope they fix it soon. Makes this entirely unusable.

  8. moved this from 🆕 Triage to 🔥 Backlog in 🧰 Octokit Activeon Jun 3, 2025
  9. skeggse commented on Jul 17, 2025

    @skeggse
    Contributor

    (Non-maintainer) I think the original report is a dupe of #2450, and the other reports here represent a different issue.

  10. moved this from Backlog to On Deck in Terraform Provideron Oct 14, 2025
  11. moved this from On Deck to In Progress in Terraform Provideron Oct 27, 2025
  12. moved this from In Progress to In Review in Terraform Provideron Oct 27, 2025
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

    Status: TriageType: Bug

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions