integrations / integrations/terraform-provider-github

Discussion: split `rules` into `branch_rules`, `push_rules` etc. in ruleset resources

Open
#3,584 1 comment 0 reactions 0 assignees View on GitHub
Needs Discussion
Dominant language
Go
Stars
1.2k
Forks
1k
Avg merge
1d 14h
Merged PRs (30d)
8

Description

Our ruleset resources currently have a `rules` Set just the GitHub API accepts it. This requires us to write custom validation logic for rules which are allowed only with a specific `target`.
To make validations and UX simpler, I'm suggesting to split the `rules` attribute into something like `branch_rules`, `tag_rules`, `push_rules` etc.

This would remove the need for us to validate which rule is allowed with with `target` and it would be clearer for our users as well that rules relate to targets.

> On the shoulders of https://github.com/integrations/terraform-provider-github/pull/3110/changes#r2827158611: What if we split the rules into separate lists based on which target they work with?

That would enable us to remove the rules validation for "is this target allowed to set this rule" and replace it with simpler built-in validators.
It would make the UX for our users nicer since they don't have to trial-and-error the rules.

_Originally posted by @deiga in https://github.com/integrations/terraform-provider-github/pull/3110#discussion_r2827187209_

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the ruleset resources, their current `rules` Set, and the target-specific validation discussed in pull request #3110. Determine the target-based attribute design and validation behavior before changing the schema; done means the API remains supported while invalid rule-target combinations are rejected clearly.

Written by the indexing model from the issue text.

Assessment

Tech stack
github, go, terraform
Domain
infrastructure, tooling
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.