No need to protect branch at creation, there is a resource to handle that

Created by: mgsegner

Hello,

I encountered issues with project creation and default branch protection. Let me detail my case.

Issue When a repository is created the default branch is protected "implicilty" by the provider, but we can not manage the protection with resource gitlab_branch_protection because it ends with an error saying the branch is already protected. So we are unable to define resource gitlab_branch_protection on the default branch to ensure it will stay protected over time. I guess the current behavior aims to copy the GUI one, but it could be annoying with the terraform usage.

Commit This commit will remove the "implicit" branch protection in the provider

New behavior At creation time default branch will not be protected Ensure the default branch is protected in terraform definition by using gitlab_branch_protection resource

This commit will change current behavior of project creation and an explicit definition of gitlab_branch_protection will be necessary after that. Do you think this commit and the new behavior are right ?

Regards,

Merge request reports

Loading