terraform-provider-flux
terraform-provider-flux copied to clipboard
Non GitHub example
The GitHub Terraform provider, comapared to the GitLab or Bitbucket provider, contains a github_repository_file
resource. This enables GitHub users to easily commit the generated manifest files to the repository that is created by Terraform.
As this is not possible in the other providers, we need an example how to deal with a generic git server. One option may be to just create a null resource that makes the commit when the manifests files change.
@phillebaba Do you know if I can configure the git source to use libgit2? The only method I found right now using terraform is to manually edit the GitRepository after its created from terraform.
It looks like the upstream issue in the GitLab provider is still stalled. Is there anything that can be done to make progress on this? I do not mean to push this just came up in Bug Scrub as it is an older issue.
There is a new PR that attempts to add support for this in the GitLab provider. Hopefully it gets merged soon. https://github.com/gitlabhq/terraform-provider-gitlab/pull/724
There was some major drawbacks with the implementation of the file resource in the GitLab provider due to a limitation in the GitLab API. See gitlabhq/terraform-provider-gitlab#724 for full discussion.
However, I created a provider which solves this issue. Link to the provider: https://registry.terraform.io/providers/akselleirv/gitlabcommit/latest/docs
@akselleirv sounds like it has the same problem as Azure DevOps but without the need to send a ref to HEAD. Seems like GitHub is the only API which has actually solved this properly with some sort of server side queuing which solves this for you.
Why cant this be solved with just a simple retry which attempts to commit the file again given that a specific error is returned? See how I solved it in the Azure DevOps provider. https://github.com/microsoft/terraform-provider-azuredevops/blob/3cb090dad31f0166892299602f06269bd2945e59/azuredevops/internal/service/git/resource_git_repository_file.go#L126-L152
Note that there are two different errors returned based on if the function should be retried or aborted.