integrations / integrations/terraform-provider-github
[BUG]: `github_actions_repository_oidc_subject_claim_customization_template permadiff
- Dominant language
- Go
- Stars
- 1.2k
- Forks
- 1k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 8
Description
### Expected Behavior
Setting `use_default = false` on a repository with no `include_claim_keys` is the documented way to opt a repository into its organization's OIDC subject-claim template. Per GitHub's [OpenID Connect reference](https://docs.github.com/en/actions/reference/security/oidc), a repository owner "will need to use the repository-level REST API to opt in to receive this configuration by setting `use_default` to false,".`
It seems reasonable that `use_default = false` with no keys should apply the org template and leave `plan` clean on subsequent runs.
### Actual Behavior
With `use_default = false` and `include_claim_keys` unset, the resource produces a permanent diff on `include_claim_keys`.
When a repo inherits the org template, GitHub returns the org's claim keys on read.
[`Read`](https://github.com/integrations/terraform-provider-github/blob/add2157906efe6ce657d6fda681635bf84336021/github/resource_github_actions_repository_oidc_subject_claim_customization_template.go#L104) writes them into state, but [`include_claim_keys`](https://github.com/integrations/terraform-provider-github/blob/add2157906efe6ce657d6fda681635bf84336021/github/resource_github_actions_repository_oidc_subject_claim_customization_template.go#L33-L41) is `Optional` and not `Computed`, so empty config vs. populated state reads as drift and causes a permanent diff.
Reported downstream in https://github.com/pulumi/pulumi-github/issues/1243.
### Terraform Version
Terraform v1.13.3
on darwin_arm64
Provider `6.11.0` (originally reported); confirmed still present at `v6.12.1`.
### GitHub Installation Type
- [ ] GitHub.com (Free, Pro, or Team)
- [ ] GitHub Enterprise Server (on-premises)
- [ ] GitHub Enterprise Cloud with Personal Accounts (github.com)
- [ ] GitHub Enterprise Cloud with Managed Users/EMU (github.com)
- [ ] GitHub Enterprise Cloud with Data Residency (*.ghe.com)
- [ ] I don't know
### Affected Resource(s)
`github_actions_repository_oidc_subject_claim_customization_template` (`include_claim_keys`)
### Terraform Configuration Files
```hcl
resource "github_actions_organization_oidc_subject_claim_customization_template" "default" {
include_claim_keys = ["repo", "context", "job_workflow_ref"]
}
resource "github_actions_repository_oidc_subject_claim_customization_template" "repo" {
repository = "my-repo"
use_default = false
# include_claim_keys intentionally omitted -> should inherit the org template
}
```
### Steps to Reproduce
1. Create an org-level template with some `include_claim_keys`.
2. Create a repository template with `use_default = false` and no `include_claim_keys`.
3. `terraform apply`, then `terraform plan` again.
4. Observe a permanent diff on `include_claim_keys` (plan wants to remove the inherited keys).
### Debug Output
```shell
```
### Code of Conduct
- [x] I agree to follow this project's Code of Conduct
Contributor guide
Research direction
Start in github/resource_github_actions_repository_oidc_subject_claim_customization_template.go, reviewing the include_claim_keys schema around lines 33–41 and Read around line 104. Reproduce the organization and repository Terraform configuration from the issue, then run apply followed by plan. Done means an omitted include_claim_keys inherits the organization template without producing a permanent diff.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github, go, terraform
- Domain
- devops, infrastructure
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100