@@ -5,6 +5,12 @@ subcategory: ""
5
5
description : |-
6
6
The gitlab_project resource allows to manage the lifecycle of a project.
7
7
A project can either be created in a group or user namespace.
8
+ -> Default Branch Protection Workaround Projects are created with default branch protection.
9
+ Since this default branch protection is not currently managed via Terraform, to workaround this limitation,
10
+ you can remove the default branch protection via the API and create your desired Terraform managed branch protection.
11
+ In the gitlab_project resource, define a local-exec provisioner which invokes
12
+ the /projects/:id/protected_branches/:name API via curl to delete the branch protection on the default
13
+ branch using a DELETE request. Then define the desired branch protection using the gitlab_branch_protection resource.
8
14
Upstream API: GitLab REST API docs https://docs.gitlab.com/ce/api/projects.html
9
15
---
10
16
@@ -14,6 +20,13 @@ The `gitlab_project` resource allows to manage the lifecycle of a project.
14
20
15
21
A project can either be created in a group or user namespace.
16
22
23
+ -> ** Default Branch Protection Workaround** Projects are created with default branch protection.
24
+ Since this default branch protection is not currently managed via Terraform, to workaround this limitation,
25
+ you can remove the default branch protection via the API and create your desired Terraform managed branch protection.
26
+ In the ` gitlab_project ` resource, define a ` local-exec ` provisioner which invokes
27
+ the ` /projects/:id/protected_branches/:name ` API via curl to delete the branch protection on the default
28
+ branch using a ` DELETE ` request. Then define the desired branch protection using the ` gitlab_branch_protection ` resource.
29
+
17
30
** Upstream API** : [ GitLab REST API docs] ( https://docs.gitlab.com/ce/api/projects.html )
18
31
19
32
## Example Usage
0 commit comments