integrations / integrations/terraform-provider-github
[MAINT]: Improve UX for github_repository_file when parallel_requests = true
- Dominant language
- Go
- Stars
- 1.2k
- Forks
- 1k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 8
Description
### Describe the need
When the provider has set the option `parallel_requests = true`
`github_repository_file` tends to fail a lot with HTTP 409 errors when more than one file is updated in the same repository, see log output further down.
Ideally I would still like the requests to run in parallel for performance, just without the 409 errors occurring. Perhaps the resource could add an extra attribute to ignore intermediary changes to the commit hash?
### SDK Version
_No response_
### API Version
_No response_
### Relevant log output
Sample config
```hcl
resource "github_repository_file" "tenant" {
for_each = {
for ns in local.tenant_namespaces :
ns.name => ns
if ns.flux.enabled
}
repository = data.github_repository.cluster.name
branch = local.cluster_branch
file = "tenants/${local.cluster_id}/${each.key}.yaml"
...
}
```
```shell
Error: PUT https://api.github.com/repos/xxx/yyy/contents/tenants/test01/myfile.yaml: 409 is at 30e15e8485d2808d7f9cdf27cecbb145252e1427 but expected 46affa9e9f78ca99714ed0e12a9c44e94e1e9055 []
│
│ with github_repository_file.tenant["myfile"],
│ on fluxcd.tf line 204, in resource "github_repository_file" "tenant":
│ 204: resource "github_repository_file" "tenant" {
```
### Code of Conduct
- [x] I agree to follow this project's Code of Conduct
Contributor guide
Assessment
This issue has not been assessed yet.