Skip to content

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

@sc0rp10

Description

@sc0rp10

Expected Behavior

The provider should allow required_workflows with zero required_workflow sub-blocks, matching the behavior of the GitHub UI and API:

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

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

Panic Output

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: TriageThis is being looked at and prioritizedType: BugSomething isn't working as documented

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions