integrations / integrations/terraform-provider-github

[DOC]: `github_branch_protection` status checks with `matrix` values don't work as documented

Open
#2,417 3 comments 0 reactions 0 assignees View on GitHub
r/branch_protection Type: Bug Type: Documentation vNext
Dominant language
Go
Stars
1.2k
Forks
1k
Avg merge
1d 14h
Merged PRs (30d)
8

Description

### Expected Behavior

The documentation: https://github.com/integrations/terraform-provider-github/blob/580961747df6864f0f9e5123ebf3003712d00feb/website/docs/r/branch_protection.html.markdown?plain=1#L117

i.e.:
> For workflows that use matrixes, append the matrix name to the value using the following pattern `([, ])`

suggests that for a workflow file looking like this:
```yaml
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
avsc: [5.7.x, 6.0.0-alpha.14]
steps:
```
(see actual file [here](https://github.com/planet-a-ventures/avsc-zstandard-codec/blob/main/.github/workflows/main.yml#L8-L13))

something like this:
```hcl
required_status_checks {
strict = true
contexts = ["build (5.7.x, 6.0.0-alpha.14)", "npm"]
}
```
should produce status checks for each of the matrix items, but it doesn't.

Only specifying it like this:
```hcl
required_status_checks {
strict = true
contexts = ["build (5.7.x)", "build (6.0.0-alpha.14)", "npm"]
}
```
produces two separate required checks correctly.

I have tried finding the code that supposedly handles the special matrix notation, but couldn't find so in 580961747df6864f0f9e5123ebf3003712d00feb. Nor can I find it in the history or any other issues or mention of `matrix` related to it anywhere in the codebase.

If I am holding it wrong, please take my apologies. If you could point me to the code handling this special case, that would be great, too.

### Actual Behavior

It produces a required status check that verbatim requires a name with all matrix values, which is never fulfilled.

### Terraform Version

Terraform `1.9.7` on `Mac OS 14.6.1 (23G93)` with `terraform-provider-github` `6.2.1`

### Affected Resource(s)

- github_branch_proctection

### Terraform Configuration Files

_No response_

### Steps to Reproduce

_No response_

### Debug Output

```shell
# github_branch_protection.avsc-zstandard-codec-main will be updated in-place
~ resource "github_branch_protection" "avsc-zstandard-codec-main" {
id = "BPR_kwDOMyV5ps4DPyW7"
# (10 unchanged attributes hidden)

~ required_status_checks {
~ contexts = [
- "build (5.7.x)",
+ "build (5.7.x, 6.0.0-alpha.14)",
# (1 unchanged element hidden)
]
# (1 unchanged attribute hidden)
}
}
```

### Panic Output

_No response_

### 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.