Add necessary arguments/resource to be able to restrict branches for pull and push mirrors
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Hello
New Resource
On the UI, it is possible to restrict mirroring (pull and push) on specific branches, using a regular expression. For now, it seems the provider only supports the "Mirror only protected branches" option, but not the ability to input a regular expression.
For example, for push mirrors:
resource "gitlab_project_mirror" "foo" {
project = "1"
url = "https://username:password@github.com/org/repository.git"
# This would be mutually exclusive with `only_protected_branches`.
only_specific_branches = "^feature/.*$"
}
For example, for the pull mirror:
resource "gitlab_project" "foo" {
[…]
# This would be mutually exclusive with `only_mirror_protected_branches`.
only_mirror_specific_branches = "^feature/.*$"
}
Related GitLab APIs
https://docs.gitlab.com/ee/api/projects.html#configure-pull-mirroring-for-a-project
https://github.com/xanzy/go-gitlab/blob/main/project_mirror.go#L43
Additional Details
-
GitLab REST API resources available (read for data sources, crud for resources) -
go-gitlabdoes support the related GitLab API already -
I'd like to contribute it myself
Edited by 🤖 GitLab Bot 🤖