Skip to content

Conversation

@Ravio1i
Copy link

@Ravio1i Ravio1i commented Jan 22, 2026

Resolves #2666


Before the change?

No possibility to create or fetch rulesets at enterprise level

After the change?

  • Create rulesets with resource
  • Fetch rulesets with datasource

Pull request checklist

  • Schema migrations have been created if needed (example)
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)

Does this introduce a breaking change?

Please see our docs on breaking changes to help!

  • Yes
  • No

Notes

  • Tested with own GitHub Enterprise Cloud Instance
  • Currently there is a race condition in the test testAccGithubEnterpriseRuleset_required_workflows: Error running post-test destroy, there may be dangling resources for vulnerability-alerts`. The test still works but the vulnerabtily alert seems to be not finished in time. Happy to hear feedback about this

@github-actions github-actions bot added the Type: Feature New feature or request label Jan 22, 2026
Copy link
Collaborator

@deiga deiga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initial pass. Not a complete review.

Please see if there are other parts of the PR where my comments might be applicable :)

ReadContext: resourceGithubEnterpriseRulesetRead,
UpdateContext: resourceGithubEnterpriseRulesetUpdate,
DeleteContext: resourceGithubEnterpriseRulesetDelete,

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add Importer functionality :)

@Ravio1i Ravio1i changed the title [FEAT]: Add Support for GitHub Enterprise Rulesets #3108 [FEAT]: Add Support for GitHub Enterprise Rulesets Jan 23, 2026
@deiga
Copy link
Collaborator

deiga commented Jan 23, 2026

You're doing good work!

I'm wondering if there are patterns from #2958 you should be copying here (for example the conditions and rules validation)

@Ravio1i
Copy link
Author

Ravio1i commented Jan 23, 2026

You're doing good work!

Thanks! although I wasted a lot of time today being utterly confused of what is actually implemented and exposed in the API/golang sdk. E.g there are parts in the go sdk, which indicate that a ruleset can use the new repository_properties, organization_properties or merge_queue, but the actual API of the Enterprise Cloud is not supporting it 🔥

I'm wondering if there are patterns from #2958 you should be copying here (for example the conditions and rules validation)

I can check it out and see if I can adjust it !

#3110 (comment)

For the importer feature: I left it out intentionally as I was under the impression it is a feature used only in UI. Not sure who actually would use it with terraform/tofu to import json in hcl.

@Ravio1i
Copy link
Author

Ravio1i commented Jan 23, 2026

I'm wondering if there are patterns from #2958 you should be copying here (for example the conditions and rules validation)

Similar to the the CustomizeDiff in #2958 I've added the util_ruleset_enterprise_validation.go to validate that:

  • ref_name is required for branch/tag, but forbidden for push/repository
  • creation, deletion, update, required_linear_history, required_signatures, pull_request, required_status_checks,
    non_fast_forward, commit_message_pattern, commit_author_email_pattern, committer_email_pattern, branch_name_pattern,
    tag_name_pattern, required_workflows, required_code_scanning, copilot_code_review rules are only valid for branch/tag
    targets
  • file_path_restriction, max_file_size, max_file_path_length, file_extension_restriction rules are only valid for push
    target
  • repository_creation, repository_deletion, repository_transfer, repository_name, repository_visibility rules are only
    valid for repository target

@deiga
Copy link
Collaborator

deiga commented Jan 23, 2026

The Importer is functionality to enable terraform import or the import block inside the config, so that existing resources can be added to state

@Ravio1i
Copy link
Author

Ravio1i commented Jan 23, 2026

The Importer is functionality to enable terraform import or the import block inside the config, so that existing resources can be added to state

Oh nevermind, yes that I will most definitely add!

I thought you were referring to the importer functionality in GitHub rulesets. Oops

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT]: Add Support for GitHub Enterprise Rulesets

2 participants