integrations / integrations/terraform-provider-github
[BUG]: required_workflows rule cannot represent empty workflows list (UI / API inconsistency)
- Dominant language
- Go
- Stars
- 1.2k
- Forks
- 1k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 8
Description
### Expected Behavior
The provider should allow `required_workflows` with zero `required_workflow` sub-blocks, matching the behavior of the GitHub UI and API:
```hcl
resource "github_organization_ruleset" "example" {
name = "strict-master"
target = "branch"
enforcement = "active"
conditions {
ref_name {
include = ["~DEFAULT_BRANCH"]
exclude = []
}
repository_name {
include = ["~ALL"]
exclude = []
}
}
rules {
required_workflows {
do_not_enforce_on_create = false
# No required_workflow blocks — should be valid
}
}
}
```
### Actual Behavior
```
Error: Insufficient required_workflow blocks
on main.tf line XX, in resource "github_organization_ruleset" "example":
At least 1 "required_workflow" blocks are required.
```
### Terraform Version
Terraform v1.5.7
on darwin_arm64
+ provider registry.terraform.io/integrations/github v6.11.1
### Affected Resource(s)
- `github_organization_ruleset`
- `github_repository_ruleset`
### Terraform Configuration Files
```hcl
```
### Steps to Reproduce
1. In the GitHub UI, create an organization ruleset
2. Enable "Require workflows to pass" without adding any specific workflows
3. Attempt to import or recreate this ruleset in Terraform
### Debug Output
```shell
```
### Panic Output
```shell
```
### Code of Conduct
- [x] I agree to follow this project's Code of Conduct
Contributor guide
Assessment
This issue has not been assessed yet.