integrations / integrations/terraform-provider-github

`update_allows_fetch_and_merge` rejected as invalid rule type for branch-target `github_repository_ruleset` (regression in 6.11.0's CustomizeDiff validation)

Open
#3,543 3 comments 0 reactions 1 assignee Claimed by @deiga View on GitHub
r/repository_ruleset Type: Bug
Dominant language
Go
Stars
1.2k
Forks
1k
Avg merge
1d 14h
Merged PRs (30d)
8

Description

### Expected Behavior
`update_allows_fetch_and_merge` should be accepted as a parameter of the `update` rule for a `branch`-target `github_repository_ruleset`, as documented, and as it worked prior to provider 6.11.0.

### Actual Behavior
`terraform plan` fails with:
```
Error: rule "update_allows_fetch_and_merge" is not valid for branch target; branch targets only support: [creation update deletion 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 workflows code_scanning required_deployments merge_queue copilot_code_review]
```
This happens even though the same config previously worked and the setting ("Allow fork syncing" in the GitHub UI) is still active on the repository — GitHub's API itself accepts this parameter fine, so the current state already has `update_allows_fetch_and_merge = true` on that ruleset.

### Root cause
The `CustomizeDiff` validation added in v6.11.0 (#2958, `util_ruleset_validation.go`, `validateRules`/`branchTagOnlyRules`) iterates over every attribute set under `rules { }` and rejects any name that isn't in a hardcoded list of `github.RepositoryRuleType` values. `update_allows_fetch_and_merge` is not itself a rule type — it's a boolean *parameter* of the `update` rule type (mirrors `UpdateRuleParameters.UpdateAllowsFetchAndMerge` in go-github) — so it can never appear in that list and is always rejected once it's `true`.

### Terraform / Provider Version
- Terraform v1.14.8
- `integrations/github` v6.13.0 (reproduces on all versions ≥ 6.11.0; confirmed working on 6.6.0)

### Affected Resource
`github_repository_ruleset`

### Steps to Reproduce
```hcl
resource "github_repository_ruleset" "this" {
name = "main"
repository = "some-repo"
target = "branch"
enforcement = "active"

conditions {
ref_name {
include = ["refs/heads/main"]
exclude = []
}
}

rules {
update = true
update_allows_fetch_and_merge = true
}
}
```
`terraform plan` (no apply needed — the error is raised by `CustomizeDiff`, purely client-side).

### Additional context
Confirmed this is not fixable via `lifecycle { ignore_changes = [...] }` on that attribute — Terraform Core reverts ignored attributes to their prior-state value before invoking the provider's plan, and since the attribute is already `true` in state, it's fed into the same buggy validation on every plan regardless of whether it's ignored, present, or absent.

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.