integrations / integrations/terraform-provider-github

[BUG]: required_workflows rule cannot represent empty workflows list (UI / API inconsistency)

Open
#3,217 1 comment 0 reactions 0 assignees View on GitHub
r/organization_ruleset Status: Triage Type: Bug
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.