Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: cannot create repository ruleset with required_code_scanning rule #2599

Open
1 task done
rdesai3 opened this issue Mar 18, 2025 · 1 comment
Open
1 task done
Labels
Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented

Comments

@rdesai3
Copy link

rdesai3 commented Mar 18, 2025

Expected Behavior

github_repository_ruleset resource with rules.required_code_scanning attribute block should create a repository ruleset should create a ruleset with required code scanning tool

Actual Behavior

github_repository_ruleset resource fails to create repository rule as it is not able to identify rules.required_code_scanning attribute block

Terraform Version

Terraform v1.11.2
on darwin_arm64

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

Affected Resource(s)

  • github_repository_ruleset

Terraform Configuration Files

resource "github_repository_ruleset" "example_ruleset" {
  name        = "example-ruleset"
  repository  = "example-repo"
  target      = "branch"
  enforcement = "active"
  rules {
    required_code_scanning {
      required_code_scanning_tool {
        alerts_threshold          = "error"
        security_alerts_threshold = "critical"
        tool                      = "CodeQL"
      }
    }
  }
  conditions {
    ref_name {
      exclude = []
      include = ["~DEFAULT_BRANCH"]
    }
  }
}

Steps to Reproduce

  1. add the example configuration to a terraform file
  2. run terraform init and terraform apply

Note: If the required_code_scanning block is commented in example configuration and applied, the apply succeeds

Debug Output

│ Error: POST https://api.github.com/repos/myorg/example-repo/rulesets: 422 Invalid request.
│ 
│ Invalid property /rules/0: data matches no possible input. See `documentation_url`. []
│ 
│   with github_repository_ruleset.example_ruleset,
│   on main.tf line 100, in resource "github_repository_ruleset" "example_ruleset":
│  100: resource "github_repository_ruleset" "example_ruleset" {
│

Panic Output

Code of Conduct

  • I agree to follow this project's Code of Conduct
@rdesai3 rdesai3 added Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented labels Mar 18, 2025
@rdesai3
Copy link
Author

rdesai3 commented Mar 19, 2025

could be related to #2556

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented
Projects
None yet
Development

No branches or pull requests

1 participant