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

[BUG]: github provider `6.5.0` is failing on updating `github_organization_ruleset`

Open mkushakov opened this issue 10 months ago • 16 comments

Expected Behavior

To make changes on resource github_organization_ruleset

Actual Behavior

Terraform crashes when executing apply.

Terraform Version

Terraform v1.7.5 on linux_amd64

  • Installed integrations/github v6.5.0 (signed by a HashiCorp partner, key ID 38027F80D7FD5FB2)

Affected Resource(s)

  • github_organization_ruleset

Terraform Configuration Files


Steps to Reproduce

terraform plan -out=tfplan -detailed-exitcode
terraform apply tfplan

Debug Output

╷
 │ Error: Plugin did not respond
 │ 
 │   with github_organization_ruleset.main_merge_check_sonarqube,
 │   on rulesets.tf line 499, in resource "github_organization_ruleset" "main_merge_check_sonarqube":
 │  499: resource "github_organization_ruleset" "main_merge_check_sonarqube" {
 │ 
 │ The plugin encountered an error, and failed to respond to the
 │ plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may
 │ contain more details.
 ╵

Panic Output

Stack trace from the terraform-provider-github_v6.5.0 plugin:
 
 panic: interface conversion: interface {} is nil, not bool
 
 goroutine 9621 [running]:
 github.com/integrations/terraform-provider-github/v6/github.expandRules({0xc000d2fac0?, 0xf16546?, 0x0?}, 0x1)
 	github.com/integrations/terraform-provider-github/v6/github/respository_rules_utils.go:327 +0x2694
 github.com/integrations/terraform-provider-github/v6/github.resourceGithubRulesetObject(0xc000912800, {0xc0004e0ad0, 0x8})
 	github.com/integrations/terraform-provider-github/v6/github/respository_rules_utils.go:33 +0x2c5
 github.com/integrations/terraform-provider-github/v6/github.resourceGithubOrganizationRulesetUpdate(0xc000912800, {0xd302c0, 0xc0003a1600})
 	github.com/integrations/terraform-provider-github/v6/github/resource_github_organization_ruleset.go:577 +0x71
 github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).update(0x1077bb0?, {0x1077bb0?, 0xc000f46ae0?}, 0xd?, {0xd302c0?, 0xc0003a1600?})
 	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:828 +0x15f
 github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc0003c8c40, {0x1077bb0, 0xc000f46ae0}, 0xc00089c270, 0xc000996300, {0xd302c0, 0xc0003a1600})
 	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:947 +0x83a
 github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc000396660, {0x1077bb0?, 0xc000f46a20?}, 0xc000a809b0)
 	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:1153 +0xd5c
 github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc0002597c0, {0x1077bb0?, 0xc000f46210?}, 0xc0004dc000)
 	github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:865 +0x3d0
 github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0xedc6c0, 0xc0002597c0}, {0x1077bb0, 0xc000f46210}, 0xc000912000, 0x0)
 	github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:518 +0x1a6
 google.golang.org/grpc.(*Server).processUnaryRPC(0xc0001ab000, {0x1077bb0, 0xc000f46180}, {0x107c4b0, 0xc0002e4180}, 0xc00030c120, 0xc00050a960, 0x1712558, 0x0)
 	google.golang.org/[email protected]/server.go:1369 +0xdf8
 google.golang.org/grpc.(*Server).handleStream(0xc0001ab000, {0x107c4b0, 0xc0002e4180}, 0xc00030c120)
 	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 39
 	google.golang.org/[email protected]/server.go:1030 +0x125
 
 Error: The terraform-provider-github_v6.5.0 plugin crashed!

Code of Conduct

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

mkushakov avatar Jan 20 '25 11:01 mkushakov

Has anyone found a workaround for this bug?

I tried to manually create the ruleset via click'ops, and then import it - which worked. But then TF wanted to update the ruleset and it failed. This one is blocking all work on a org-wide ruleset.

tim-acima avatar Feb 18 '25 23:02 tim-acima

@tim-acima we just rolled back to previous version as workaround :(

mkushakov avatar Feb 26 '25 12:02 mkushakov

@tim-acima same here. It works well like that but it is inconvenient.

required_providers {
  github = {
    source  = "integrations/github"
-    version = "= 6.5.0"
+    version = "= 6.4.0"
  }
}

osakiy avatar Mar 07 '25 12:03 osakiy

I just came to report the same issue.

I have just added this as a temp workout, ensuring the config is correctly set in the UI.

    # intrim fix for the resource modification not executing correctly
    ignore_changes = [rules[0].deletion, rules[0].required_linear_history]

ashraidiam avatar Mar 10 '25 12:03 ashraidiam

Hey @kfcampbell , any chance a bug fix on this could make it into the next release? 🙏

tim-acima avatar Mar 12 '25 16:03 tim-acima

Pinging this issue again, to keep it from going stale. We're still running into this issue.

tim-acima avatar Mar 27 '25 15:03 tim-acima

Same issue we are having.

jtaguinod avatar Apr 11 '25 09:04 jtaguinod

conditions { ref_name { include = ["~DEFAULT_BRANCH"] exclude = [] } }

Make sure include is not empty. It worked for me after that.

jtaguinod avatar Apr 11 '25 14:04 jtaguinod

conditions {                                                                                                                                                                                                                                                                    
    repository_name {                                                                                                                                                                                                                                                             
      include = ["~ALL"]                                                                                                                                                                                                                                                          
      exclude = ["template"]                                                                                                                                                                                                                                                      
    }                                                                                                                                                                                                                                                                             
    ref_name {                                                                                                                                                                                                                                                                    
      include = ["~DEFAULT_BRANCH"]                                                                                                                                                                                                                                               
      exclude = []                                                                                                                                                                                                                                                                
    }                                                                                                                                                                                                                                                                             
  }    

This is exactly what I have and I still get the error.

grimm26 avatar Apr 11 '25 14:04 grimm26

conditions {                                                                                                                                                                                                                                                                    
    repository_name {                                                                                                                                                                                                                                                             
      include = ["~ALL"]                                                                                                                                                                                                                                                          
      exclude = ["template"]                                                                                                                                                                                                                                                      
    }                                                                                                                                                                                                                                                                             
    ref_name {                                                                                                                                                                                                                                                                    
      include = ["~DEFAULT_BRANCH"]                                                                                                                                                                                                                                               
      exclude = []                                                                                                                                                                                                                                                                
    }                                                                                                                                                                                                                                                                             
  }    

This is exactly what I have and I still get the error.

try this. replace include = ["~ALL"] with include = ["*"]

jtaguinod avatar Apr 11 '25 14:04 jtaguinod

ok, but https://registry.terraform.io/providers/integrations/github/latest/docs/resources/organization_ruleset#include-2

Still crashes with "*" in conditions.repository_name.include = ["*"]


panic: interface conversion: interface {} is nil, not bool

goroutine 132 [running]:
github.com/integrations/terraform-provider-github/v6/github.expandRules({0xc000782f30?, 0xf1b546?, 0x0?}, 0x1)
	github.com/integrations/terraform-provider-github/v6/github/respository_rules_utils.go:343 +0x2a54
github.com/integrations/terraform-provider-github/v6/github.resourceGithubRulesetObject(0xc00051d280, {0xc000298ce0, 0xa})
	github.com/integrations/terraform-provider-github/v6/github/respository_rules_utils.go:33 +0x2c5
github.com/integrations/terraform-provider-github/v6/github.resourceGithubOrganizationRulesetUpdate(0xc00051d280, {0xd352c0, 0xc0002efb00})
	github.com/integrations/terraform-provider-github/v6/github/resource_github_organization_ruleset.go:577 +0x71
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).update(0x107d470?, {0x107d470?, 0xc0001b86c0?}, 0xd?, {0xd352c0?, 0xc0002efb00?})
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:828 +0x15f
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc0003a6c40, {0x107d470, 0xc0001b86c0}, 0xc0005e2c30, 0xc00051d100, {0xd352c0, 0xc0002efb00})
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:947 +0x83a
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc000374678, {0x107d470?, 0xc0001b85d0?}, 0xc0007b4f50)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:1153 +0xd5c
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc000275900, {0x107d470?, 0xc0000bba70?}, 0xc000232a80)
	github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:865 +0x3d0
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0xee16c0, 0xc000275900}, {0x107d470, 0xc0000bba70}, 0xc00082dd00, 0x0)
	github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:518 +0x1a6
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0001a3000, {0x107d470, 0xc0000bb9e0}, {0x1081d68, 0xc000230300}, 0xc000474a20, 0xc0004deab0, 0x1719558, 0x0)
	google.golang.org/[email protected]/server.go:1369 +0xdf8
google.golang.org/grpc.(*Server).handleStream(0xc0001a3000, {0x1081d68, 0xc000230300}, 0xc000474a20)
	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 66
	google.golang.org/[email protected]/server.go:1030 +0x125

Error: The terraform-provider-github_v6.6.0 plugin crashed!

grimm26 avatar Apr 11 '25 15:04 grimm26

Is there any progress with this issue?

ashraidiam avatar Apr 28 '25 10:04 ashraidiam

Nudging this again... so it doesn't go stale.

tim-acima avatar Apr 30 '25 17:04 tim-acima

Image

tim-acima avatar May 07 '25 20:05 tim-acima

This issue prevents everyone using github_organization_ruleset from upgrading, there is no known workaround, and it's been 4 months already. There are also no other official way for Enterprise customers like ourselves to properly configure GitHub at scale. And GitHub is apparently asking their teams to focus on other things.

What should we do @kfcampbell @nickfloyd? I know you are not responsible for this, but the situation must be escalated somehow.

tzoratto avatar May 16 '25 09:05 tzoratto

This issue prevents everyone using github_organization_ruleset from upgrading, there is no known workaround, and it's been 4 months already. There are also no other official way for Enterprise customers like ourselves to properly configure GitHub at scale. And GitHub is apparently asking their teams to focus on other things.

What should we do @kfcampbell @nickfloyd? I know you are not responsible for this, but the situation must be escalated somehow.

And I've seen on linkedin that github is laying people off, too. If they can't properly staff this with github employees, give some volunteers push access.

grimm26 avatar May 16 '25 13:05 grimm26

Hello there! Hitting the same, commenting to not stale :)

joseluisjimenez1 avatar Jul 02 '25 13:07 joseluisjimenez1

fails for me with

goroutine 15 [running]:
github.com/integrations/terraform-provider-github/v6/github.expandRules({0x1400077c030?, 0x100b86c13?, 0x0?}, 0x1)
	github.com/integrations/terraform-provider-github/v6/github/respository_rules_utils.go:343 +0x25a0
...

which asks for this https://github.com/integrations/terraform-provider-github/blob/9fceeda3663a1bcb48c01e51da109947be65896c/github/respository_rules_utils.go#L343

and which is NOT defined in the schema around https://github.com/integrations/terraform-provider-github/blob/9fceeda3663a1bcb48c01e51da109947be65896c/github/resource_github_organization_ruleset.go#L259

The fix would be straightforward and easy... too bad GitHub Org doesn't treat support of this provider with slightly higher priority :/

sfuerte avatar Jul 07 '25 23:07 sfuerte

@sfuerte feel free to open PR to contribute if you think the fix is easy

mkushakov avatar Jul 08 '25 06:07 mkushakov

@mkushakov Have you seen the current state of this repository? PR fixing blocking issues such as this one are not even reviewed by the GitHub team…

tzoratto avatar Jul 08 '25 07:07 tzoratto

as an option, as well as for promoting discussion and upvoting there 😃 https://github.com/orgs/opentofu/discussions/3019

sfuerte avatar Jul 11 '25 17:07 sfuerte

We have forked and fixed this issue on top of other improvements like go-github sdk bump to recent version, added more features support for rulesets and rewrite provider using terraform provider framework instead of old plugin sdk https://registry.terraform.io/providers/nexthink-oss/github/latest

mkushakov avatar Sep 11 '25 12:09 mkushakov

Submitted a ticket today asking for GitHub support or attention to this issue. I received this as a response:

terraform-provider-github is not something GitHub can support at this time. However, this issue has been brought up with GitHub's product leadership team. We are currently focused on API scaling investments and are exploring options to ensure the health of this project.

If you're paying for GitHub, I'd suggest putting in a ticket as well to increase awareness of support shortcomings.

tim-acima avatar Sep 15 '25 16:09 tim-acima

Submitted a ticket today asking for GitHub support or attention to this issue. I received this as a response:

terraform-provider-github is not something GitHub can support at this time. However, this issue has been brought up with GitHub's product leadership team. We are currently focused on API scaling investments and are exploring options to ensure the health of this project.

If you're paying for GitHub, I'd suggest putting in a ticket as well to increase awareness of support shortcomings.

I have and was basically given the same brush-off. I hold little hope in M$ support of an open source project. I see 2 options:

  1. we converge on a fork and that becomes the default github provider going forward
  2. migrate to gitlab

grimm26 avatar Sep 15 '25 19:09 grimm26