published on Friday, Jun 26, 2026 by Pulumi
published on Friday, Jun 26, 2026 by Pulumi
The gitlab.BranchProtection resource manages the lifecycle of a protected branch of a repository.
Branch Protection Behavior for the default branch Depending on the GitLab instance, group or project setting the default branch of a project is created automatically by GitLab behind the scenes. Due to some limitations in the Terraform Provider SDK and the GitLab API, when creating a new project and trying to manage the branch protection setting for its default branch the
gitlab.BranchProtectionresource will automatically take ownership of the default branch without an explicit import by unprotecting and properly protecting it again. Having multiplegitlab.BranchProtectionresources for the same project and default branch will result in them overriding each other - make sure to only have a single one.
The
allowedToPush,allowedToMerge,allowedToUnprotectandcodeOwnerApprovalRequiredattributes require a GitLab Enterprise instance.
The
mergeAccessLevelandpushAccessLevelattributes are not available for GitLab Enterprise. UseallowedToMergeandallowedToPushinstead.
Upstream API: GitLab REST API docs
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as gitlab from "@pulumi/gitlab";
// CE example
const ceBranch = new gitlab.BranchProtection("ce_branch", {
project: "12345",
branch: "BranchProtected",
pushAccessLevel: "developer",
mergeAccessLevel: "developer",
allowForcePush: true,
});
// EE example
const eeBranch = new gitlab.BranchProtection("ee_branch", {
project: "12345",
branch: "BranchProtected",
allowForcePush: true,
codeOwnerApprovalRequired: true,
allowedToPushes: [
{
userId: 5,
},
{
userId: 521,
},
{
accessLevel: "no one",
},
],
allowedToMerges: [
{
userId: 15,
},
{
userId: 37,
},
{
accessLevel: "maintainer",
},
],
allowedToUnprotects: [
{
userId: 15,
},
{
groupId: 42,
},
{
accessLevel: "maintainer",
},
],
});
// EE example with admin push access level
const adminPush = new gitlab.BranchProtection("admin_push", {
project: "12345",
branch: "admin-protected",
allowedToPushes: [{
accessLevel: "admin",
}],
allowedToMerges: [{
accessLevel: "maintainer",
}],
allowedToUnprotects: [{
accessLevel: "maintainer",
}],
});
import pulumi
import pulumi_gitlab as gitlab
# CE example
ce_branch = gitlab.BranchProtection("ce_branch",
project="12345",
branch="BranchProtected",
push_access_level="developer",
merge_access_level="developer",
allow_force_push=True)
# EE example
ee_branch = gitlab.BranchProtection("ee_branch",
project="12345",
branch="BranchProtected",
allow_force_push=True,
code_owner_approval_required=True,
allowed_to_pushes=[
{
"user_id": 5,
},
{
"user_id": 521,
},
{
"access_level": "no one",
},
],
allowed_to_merges=[
{
"user_id": 15,
},
{
"user_id": 37,
},
{
"access_level": "maintainer",
},
],
allowed_to_unprotects=[
{
"user_id": 15,
},
{
"group_id": 42,
},
{
"access_level": "maintainer",
},
])
# EE example with admin push access level
admin_push = gitlab.BranchProtection("admin_push",
project="12345",
branch="admin-protected",
allowed_to_pushes=[{
"access_level": "admin",
}],
allowed_to_merges=[{
"access_level": "maintainer",
}],
allowed_to_unprotects=[{
"access_level": "maintainer",
}])
package main
import (
"github.com/pulumi/pulumi-gitlab/sdk/v10/go/gitlab"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
// CE example
_, err := gitlab.NewBranchProtection(ctx, "ce_branch", &gitlab.BranchProtectionArgs{
Project: pulumi.String("12345"),
Branch: pulumi.String("BranchProtected"),
PushAccessLevel: pulumi.String("developer"),
MergeAccessLevel: pulumi.String("developer"),
AllowForcePush: pulumi.Bool(true),
})
if err != nil {
return err
}
// EE example
_, err = gitlab.NewBranchProtection(ctx, "ee_branch", &gitlab.BranchProtectionArgs{
Project: pulumi.String("12345"),
Branch: pulumi.String("BranchProtected"),
AllowForcePush: pulumi.Bool(true),
CodeOwnerApprovalRequired: pulumi.Bool(true),
AllowedToPushes: gitlab.BranchProtectionAllowedToPushArray{
&gitlab.BranchProtectionAllowedToPushArgs{
UserId: pulumi.Int(5),
},
&gitlab.BranchProtectionAllowedToPushArgs{
UserId: pulumi.Int(521),
},
&gitlab.BranchProtectionAllowedToPushArgs{
AccessLevel: pulumi.String("no one"),
},
},
AllowedToMerges: gitlab.BranchProtectionAllowedToMergeArray{
&gitlab.BranchProtectionAllowedToMergeArgs{
UserId: pulumi.Int(15),
},
&gitlab.BranchProtectionAllowedToMergeArgs{
UserId: pulumi.Int(37),
},
&gitlab.BranchProtectionAllowedToMergeArgs{
AccessLevel: pulumi.String("maintainer"),
},
},
AllowedToUnprotects: gitlab.BranchProtectionAllowedToUnprotectArray{
&gitlab.BranchProtectionAllowedToUnprotectArgs{
UserId: pulumi.Int(15),
},
&gitlab.BranchProtectionAllowedToUnprotectArgs{
GroupId: pulumi.Int(42),
},
&gitlab.BranchProtectionAllowedToUnprotectArgs{
AccessLevel: pulumi.String("maintainer"),
},
},
})
if err != nil {
return err
}
// EE example with admin push access level
_, err = gitlab.NewBranchProtection(ctx, "admin_push", &gitlab.BranchProtectionArgs{
Project: pulumi.String("12345"),
Branch: pulumi.String("admin-protected"),
AllowedToPushes: gitlab.BranchProtectionAllowedToPushArray{
&gitlab.BranchProtectionAllowedToPushArgs{
AccessLevel: pulumi.String("admin"),
},
},
AllowedToMerges: gitlab.BranchProtectionAllowedToMergeArray{
&gitlab.BranchProtectionAllowedToMergeArgs{
AccessLevel: pulumi.String("maintainer"),
},
},
AllowedToUnprotects: gitlab.BranchProtectionAllowedToUnprotectArray{
&gitlab.BranchProtectionAllowedToUnprotectArgs{
AccessLevel: pulumi.String("maintainer"),
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using GitLab = Pulumi.GitLab;
return await Deployment.RunAsync(() =>
{
// CE example
var ceBranch = new GitLab.BranchProtection("ce_branch", new()
{
Project = "12345",
Branch = "BranchProtected",
PushAccessLevel = "developer",
MergeAccessLevel = "developer",
AllowForcePush = true,
});
// EE example
var eeBranch = new GitLab.BranchProtection("ee_branch", new()
{
Project = "12345",
Branch = "BranchProtected",
AllowForcePush = true,
CodeOwnerApprovalRequired = true,
AllowedToPushes = new[]
{
new GitLab.Inputs.BranchProtectionAllowedToPushArgs
{
UserId = 5,
},
new GitLab.Inputs.BranchProtectionAllowedToPushArgs
{
UserId = 521,
},
new GitLab.Inputs.BranchProtectionAllowedToPushArgs
{
AccessLevel = "no one",
},
},
AllowedToMerges = new[]
{
new GitLab.Inputs.BranchProtectionAllowedToMergeArgs
{
UserId = 15,
},
new GitLab.Inputs.BranchProtectionAllowedToMergeArgs
{
UserId = 37,
},
new GitLab.Inputs.BranchProtectionAllowedToMergeArgs
{
AccessLevel = "maintainer",
},
},
AllowedToUnprotects = new[]
{
new GitLab.Inputs.BranchProtectionAllowedToUnprotectArgs
{
UserId = 15,
},
new GitLab.Inputs.BranchProtectionAllowedToUnprotectArgs
{
GroupId = 42,
},
new GitLab.Inputs.BranchProtectionAllowedToUnprotectArgs
{
AccessLevel = "maintainer",
},
},
});
// EE example with admin push access level
var adminPush = new GitLab.BranchProtection("admin_push", new()
{
Project = "12345",
Branch = "admin-protected",
AllowedToPushes = new[]
{
new GitLab.Inputs.BranchProtectionAllowedToPushArgs
{
AccessLevel = "admin",
},
},
AllowedToMerges = new[]
{
new GitLab.Inputs.BranchProtectionAllowedToMergeArgs
{
AccessLevel = "maintainer",
},
},
AllowedToUnprotects = new[]
{
new GitLab.Inputs.BranchProtectionAllowedToUnprotectArgs
{
AccessLevel = "maintainer",
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gitlab.BranchProtection;
import com.pulumi.gitlab.BranchProtectionArgs;
import com.pulumi.gitlab.inputs.BranchProtectionAllowedToPushArgs;
import com.pulumi.gitlab.inputs.BranchProtectionAllowedToMergeArgs;
import com.pulumi.gitlab.inputs.BranchProtectionAllowedToUnprotectArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
// CE example
var ceBranch = new BranchProtection("ceBranch", BranchProtectionArgs.builder()
.project("12345")
.branch("BranchProtected")
.pushAccessLevel("developer")
.mergeAccessLevel("developer")
.allowForcePush(true)
.build());
// EE example
var eeBranch = new BranchProtection("eeBranch", BranchProtectionArgs.builder()
.project("12345")
.branch("BranchProtected")
.allowForcePush(true)
.codeOwnerApprovalRequired(true)
.allowedToPushes(
BranchProtectionAllowedToPushArgs.builder()
.userId(5)
.build(),
BranchProtectionAllowedToPushArgs.builder()
.userId(521)
.build(),
BranchProtectionAllowedToPushArgs.builder()
.accessLevel("no one")
.build())
.allowedToMerges(
BranchProtectionAllowedToMergeArgs.builder()
.userId(15)
.build(),
BranchProtectionAllowedToMergeArgs.builder()
.userId(37)
.build(),
BranchProtectionAllowedToMergeArgs.builder()
.accessLevel("maintainer")
.build())
.allowedToUnprotects(
BranchProtectionAllowedToUnprotectArgs.builder()
.userId(15)
.build(),
BranchProtectionAllowedToUnprotectArgs.builder()
.groupId(42)
.build(),
BranchProtectionAllowedToUnprotectArgs.builder()
.accessLevel("maintainer")
.build())
.build());
// EE example with admin push access level
var adminPush = new BranchProtection("adminPush", BranchProtectionArgs.builder()
.project("12345")
.branch("admin-protected")
.allowedToPushes(BranchProtectionAllowedToPushArgs.builder()
.accessLevel("admin")
.build())
.allowedToMerges(BranchProtectionAllowedToMergeArgs.builder()
.accessLevel("maintainer")
.build())
.allowedToUnprotects(BranchProtectionAllowedToUnprotectArgs.builder()
.accessLevel("maintainer")
.build())
.build());
}
}
resources:
# CE example
ceBranch:
type: gitlab:BranchProtection
name: ce_branch
properties:
project: '12345'
branch: BranchProtected
pushAccessLevel: developer
mergeAccessLevel: developer
allowForcePush: true
# EE example
eeBranch:
type: gitlab:BranchProtection
name: ee_branch
properties:
project: '12345'
branch: BranchProtected
allowForcePush: true
codeOwnerApprovalRequired: true
allowedToPushes:
- userId: 5
- userId: 521
- accessLevel: no one
allowedToMerges:
- userId: 15
- userId: 37
- accessLevel: maintainer
allowedToUnprotects:
- userId: 15
- groupId: 42
- accessLevel: maintainer
# EE example with admin push access level
adminPush:
type: gitlab:BranchProtection
name: admin_push
properties:
project: '12345'
branch: admin-protected
allowedToPushes:
- accessLevel: admin
allowedToMerges:
- accessLevel: maintainer
allowedToUnprotects:
- accessLevel: maintainer
pulumi {
required_providers {
gitlab = {
source = "pulumi/gitlab"
}
}
}
# CE example
resource "gitlab_branchprotection" "ce_branch" {
project = "12345"
branch = "BranchProtected"
push_access_level = "developer"
merge_access_level = "developer"
allow_force_push = true
}
# EE example
resource "gitlab_branchprotection" "ee_branch" {
project = "12345"
branch = "BranchProtected"
allow_force_push = true
code_owner_approval_required = true
allowed_to_pushes {
user_id = 5
}
allowed_to_pushes {
user_id = 521
}
allowed_to_pushes {
access_level = "no one"
}
allowed_to_merges {
user_id = 15
}
allowed_to_merges {
user_id = 37
}
allowed_to_merges {
access_level = "maintainer"
}
allowed_to_unprotects {
user_id = 15
}
allowed_to_unprotects {
group_id = 42
}
allowed_to_unprotects {
access_level = "maintainer"
}
}
# EE example with admin push access level
resource "gitlab_branchprotection" "admin_push" {
project = "12345"
branch = "admin-protected"
allowed_to_pushes {
access_level = "admin"
}
allowed_to_merges {
access_level = "maintainer"
}
allowed_to_unprotects {
access_level = "maintainer"
}
}
Create BranchProtection Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new BranchProtection(name: string, args: BranchProtectionArgs, opts?: CustomResourceOptions);@overload
def BranchProtection(resource_name: str,
args: BranchProtectionArgs,
opts: Optional[ResourceOptions] = None)
@overload
def BranchProtection(resource_name: str,
opts: Optional[ResourceOptions] = None,
branch: Optional[str] = None,
project: Optional[str] = None,
allow_force_push: Optional[bool] = None,
allowed_to_merges: Optional[Sequence[BranchProtectionAllowedToMergeArgs]] = None,
allowed_to_pushes: Optional[Sequence[BranchProtectionAllowedToPushArgs]] = None,
allowed_to_unprotects: Optional[Sequence[BranchProtectionAllowedToUnprotectArgs]] = None,
code_owner_approval_required: Optional[bool] = None,
merge_access_level: Optional[str] = None,
push_access_level: Optional[str] = None)func NewBranchProtection(ctx *Context, name string, args BranchProtectionArgs, opts ...ResourceOption) (*BranchProtection, error)public BranchProtection(string name, BranchProtectionArgs args, CustomResourceOptions? opts = null)
public BranchProtection(String name, BranchProtectionArgs args)
public BranchProtection(String name, BranchProtectionArgs args, CustomResourceOptions options)
type: gitlab:BranchProtection
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
resource "gitlab_branchprotection" "name" {
# resource properties
}Parameters
- name string
- The unique name of the resource.
- args BranchProtectionArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args BranchProtectionArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args BranchProtectionArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args BranchProtectionArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args BranchProtectionArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var branchProtectionResource = new GitLab.BranchProtection("branchProtectionResource", new()
{
Branch = "string",
Project = "string",
AllowForcePush = false,
AllowedToMerges = new[]
{
new GitLab.Inputs.BranchProtectionAllowedToMergeArgs
{
AccessLevel = "string",
AccessLevelDescription = "string",
GroupId = 0,
UserId = 0,
},
},
AllowedToPushes = new[]
{
new GitLab.Inputs.BranchProtectionAllowedToPushArgs
{
AccessLevel = "string",
AccessLevelDescription = "string",
DeployKeyId = 0,
GroupId = 0,
UserId = 0,
},
},
AllowedToUnprotects = new[]
{
new GitLab.Inputs.BranchProtectionAllowedToUnprotectArgs
{
AccessLevel = "string",
AccessLevelDescription = "string",
GroupId = 0,
UserId = 0,
},
},
CodeOwnerApprovalRequired = false,
MergeAccessLevel = "string",
PushAccessLevel = "string",
});
example, err := gitlab.NewBranchProtection(ctx, "branchProtectionResource", &gitlab.BranchProtectionArgs{
Branch: pulumi.String("string"),
Project: pulumi.String("string"),
AllowForcePush: pulumi.Bool(false),
AllowedToMerges: gitlab.BranchProtectionAllowedToMergeArray{
&gitlab.BranchProtectionAllowedToMergeArgs{
AccessLevel: pulumi.String("string"),
AccessLevelDescription: pulumi.String("string"),
GroupId: pulumi.Int(0),
UserId: pulumi.Int(0),
},
},
AllowedToPushes: gitlab.BranchProtectionAllowedToPushArray{
&gitlab.BranchProtectionAllowedToPushArgs{
AccessLevel: pulumi.String("string"),
AccessLevelDescription: pulumi.String("string"),
DeployKeyId: pulumi.Int(0),
GroupId: pulumi.Int(0),
UserId: pulumi.Int(0),
},
},
AllowedToUnprotects: gitlab.BranchProtectionAllowedToUnprotectArray{
&gitlab.BranchProtectionAllowedToUnprotectArgs{
AccessLevel: pulumi.String("string"),
AccessLevelDescription: pulumi.String("string"),
GroupId: pulumi.Int(0),
UserId: pulumi.Int(0),
},
},
CodeOwnerApprovalRequired: pulumi.Bool(false),
MergeAccessLevel: pulumi.String("string"),
PushAccessLevel: pulumi.String("string"),
})
resource "gitlab_branchprotection" "branchProtectionResource" {
branch = "string"
project = "string"
allow_force_push = false
allowed_to_merges {
access_level = "string"
access_level_description = "string"
group_id = 0
user_id = 0
}
allowed_to_pushes {
access_level = "string"
access_level_description = "string"
deploy_key_id = 0
group_id = 0
user_id = 0
}
allowed_to_unprotects {
access_level = "string"
access_level_description = "string"
group_id = 0
user_id = 0
}
code_owner_approval_required = false
merge_access_level = "string"
push_access_level = "string"
}
var branchProtectionResource = new BranchProtection("branchProtectionResource", BranchProtectionArgs.builder()
.branch("string")
.project("string")
.allowForcePush(false)
.allowedToMerges(BranchProtectionAllowedToMergeArgs.builder()
.accessLevel("string")
.accessLevelDescription("string")
.groupId(0)
.userId(0)
.build())
.allowedToPushes(BranchProtectionAllowedToPushArgs.builder()
.accessLevel("string")
.accessLevelDescription("string")
.deployKeyId(0)
.groupId(0)
.userId(0)
.build())
.allowedToUnprotects(BranchProtectionAllowedToUnprotectArgs.builder()
.accessLevel("string")
.accessLevelDescription("string")
.groupId(0)
.userId(0)
.build())
.codeOwnerApprovalRequired(false)
.mergeAccessLevel("string")
.pushAccessLevel("string")
.build());
branch_protection_resource = gitlab.BranchProtection("branchProtectionResource",
branch="string",
project="string",
allow_force_push=False,
allowed_to_merges=[{
"access_level": "string",
"access_level_description": "string",
"group_id": 0,
"user_id": 0,
}],
allowed_to_pushes=[{
"access_level": "string",
"access_level_description": "string",
"deploy_key_id": 0,
"group_id": 0,
"user_id": 0,
}],
allowed_to_unprotects=[{
"access_level": "string",
"access_level_description": "string",
"group_id": 0,
"user_id": 0,
}],
code_owner_approval_required=False,
merge_access_level="string",
push_access_level="string")
const branchProtectionResource = new gitlab.BranchProtection("branchProtectionResource", {
branch: "string",
project: "string",
allowForcePush: false,
allowedToMerges: [{
accessLevel: "string",
accessLevelDescription: "string",
groupId: 0,
userId: 0,
}],
allowedToPushes: [{
accessLevel: "string",
accessLevelDescription: "string",
deployKeyId: 0,
groupId: 0,
userId: 0,
}],
allowedToUnprotects: [{
accessLevel: "string",
accessLevelDescription: "string",
groupId: 0,
userId: 0,
}],
codeOwnerApprovalRequired: false,
mergeAccessLevel: "string",
pushAccessLevel: "string",
});
type: gitlab:BranchProtection
properties:
allowForcePush: false
allowedToMerges:
- accessLevel: string
accessLevelDescription: string
groupId: 0
userId: 0
allowedToPushes:
- accessLevel: string
accessLevelDescription: string
deployKeyId: 0
groupId: 0
userId: 0
allowedToUnprotects:
- accessLevel: string
accessLevelDescription: string
groupId: 0
userId: 0
branch: string
codeOwnerApprovalRequired: false
mergeAccessLevel: string
project: string
pushAccessLevel: string
BranchProtection Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The BranchProtection resource accepts the following input properties:
- Branch string
- Name of the branch.
- Project string
- The id of the project.
- Allow
Force boolPush - Can be set to true to allow users with push access to force push.
- Allowed
To List<Pulumi.Merges Git Lab. Inputs. Branch Protection Allowed To Merge> - Array of merge access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
- Allowed
To List<Pulumi.Pushes Git Lab. Inputs. Branch Protection Allowed To Push> - Array of push access levels/users/groups/deploy keys allowed for the protected branch. Only available for Premium and Ultimate instances.
- Allowed
To List<Pulumi.Unprotects Git Lab. Inputs. Branch Protection Allowed To Unprotect> - Array of unprotect access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
- Code
Owner boolApproval Required - Can be set to true to require code owner approval before merging. Only available for Premium and Ultimate instances.
- Merge
Access stringLevel - Access levels allowed to merge. Valid values are:
no one,developer,maintainer,admin. Only available for CE instances. - Push
Access stringLevel - Access levels allowed to push. Valid values are:
no one,developer,maintainer,admin. Only available for CE instances.
- Branch string
- Name of the branch.
- Project string
- The id of the project.
- Allow
Force boolPush - Can be set to true to allow users with push access to force push.
- Allowed
To []BranchMerges Protection Allowed To Merge Args - Array of merge access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
- Allowed
To []BranchPushes Protection Allowed To Push Args - Array of push access levels/users/groups/deploy keys allowed for the protected branch. Only available for Premium and Ultimate instances.
- Allowed
To []BranchUnprotects Protection Allowed To Unprotect Args - Array of unprotect access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
- Code
Owner boolApproval Required - Can be set to true to require code owner approval before merging. Only available for Premium and Ultimate instances.
- Merge
Access stringLevel - Access levels allowed to merge. Valid values are:
no one,developer,maintainer,admin. Only available for CE instances. - Push
Access stringLevel - Access levels allowed to push. Valid values are:
no one,developer,maintainer,admin. Only available for CE instances.
- branch string
- Name of the branch.
- project string
- The id of the project.
- allow_
force_ boolpush - Can be set to true to allow users with push access to force push.
- allowed_
to_ list(object)merges - Array of merge access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
- allowed_
to_ list(object)pushes - Array of push access levels/users/groups/deploy keys allowed for the protected branch. Only available for Premium and Ultimate instances.
- allowed_
to_ list(object)unprotects - Array of unprotect access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
- code_
owner_ boolapproval_ required - Can be set to true to require code owner approval before merging. Only available for Premium and Ultimate instances.
- merge_
access_ stringlevel - Access levels allowed to merge. Valid values are:
no one,developer,maintainer,admin. Only available for CE instances. - push_
access_ stringlevel - Access levels allowed to push. Valid values are:
no one,developer,maintainer,admin. Only available for CE instances.
- branch String
- Name of the branch.
- project String
- The id of the project.
- allow
Force BooleanPush - Can be set to true to allow users with push access to force push.
- allowed
To List<BranchMerges Protection Allowed To Merge> - Array of merge access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
- allowed
To List<BranchPushes Protection Allowed To Push> - Array of push access levels/users/groups/deploy keys allowed for the protected branch. Only available for Premium and Ultimate instances.
- allowed
To List<BranchUnprotects Protection Allowed To Unprotect> - Array of unprotect access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
- code
Owner BooleanApproval Required - Can be set to true to require code owner approval before merging. Only available for Premium and Ultimate instances.
- merge
Access StringLevel - Access levels allowed to merge. Valid values are:
no one,developer,maintainer,admin. Only available for CE instances. - push
Access StringLevel - Access levels allowed to push. Valid values are:
no one,developer,maintainer,admin. Only available for CE instances.
- branch string
- Name of the branch.
- project string
- The id of the project.
- allow
Force booleanPush - Can be set to true to allow users with push access to force push.
- allowed
To BranchMerges Protection Allowed To Merge[] - Array of merge access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
- allowed
To BranchPushes Protection Allowed To Push[] - Array of push access levels/users/groups/deploy keys allowed for the protected branch. Only available for Premium and Ultimate instances.
- allowed
To BranchUnprotects Protection Allowed To Unprotect[] - Array of unprotect access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
- code
Owner booleanApproval Required - Can be set to true to require code owner approval before merging. Only available for Premium and Ultimate instances.
- merge
Access stringLevel - Access levels allowed to merge. Valid values are:
no one,developer,maintainer,admin. Only available for CE instances. - push
Access stringLevel - Access levels allowed to push. Valid values are:
no one,developer,maintainer,admin. Only available for CE instances.
- branch str
- Name of the branch.
- project str
- The id of the project.
- allow_
force_ boolpush - Can be set to true to allow users with push access to force push.
- allowed_
to_ Sequence[Branchmerges Protection Allowed To Merge Args] - Array of merge access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
- allowed_
to_ Sequence[Branchpushes Protection Allowed To Push Args] - Array of push access levels/users/groups/deploy keys allowed for the protected branch. Only available for Premium and Ultimate instances.
- allowed_
to_ Sequence[Branchunprotects Protection Allowed To Unprotect Args] - Array of unprotect access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
- code_
owner_ boolapproval_ required - Can be set to true to require code owner approval before merging. Only available for Premium and Ultimate instances.
- merge_
access_ strlevel - Access levels allowed to merge. Valid values are:
no one,developer,maintainer,admin. Only available for CE instances. - push_
access_ strlevel - Access levels allowed to push. Valid values are:
no one,developer,maintainer,admin. Only available for CE instances.
- branch String
- Name of the branch.
- project String
- The id of the project.
- allow
Force BooleanPush - Can be set to true to allow users with push access to force push.
- allowed
To List<Property Map>Merges - Array of merge access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
- allowed
To List<Property Map>Pushes - Array of push access levels/users/groups/deploy keys allowed for the protected branch. Only available for Premium and Ultimate instances.
- allowed
To List<Property Map>Unprotects - Array of unprotect access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
- code
Owner BooleanApproval Required - Can be set to true to require code owner approval before merging. Only available for Premium and Ultimate instances.
- merge
Access StringLevel - Access levels allowed to merge. Valid values are:
no one,developer,maintainer,admin. Only available for CE instances. - push
Access StringLevel - Access levels allowed to push. Valid values are:
no one,developer,maintainer,admin. Only available for CE instances.
Outputs
All input properties are implicitly available as output properties. Additionally, the BranchProtection resource produces the following output properties:
- Branch
Protection intId - The ID of the branch protection (not the branch name).
- Id string
- The provider-assigned unique ID for this managed resource.
- Branch
Protection intId - The ID of the branch protection (not the branch name).
- Id string
- The provider-assigned unique ID for this managed resource.
- branch_
protection_ numberid - The ID of the branch protection (not the branch name).
- id string
- The provider-assigned unique ID for this managed resource.
- branch
Protection IntegerId - The ID of the branch protection (not the branch name).
- id String
- The provider-assigned unique ID for this managed resource.
- branch
Protection numberId - The ID of the branch protection (not the branch name).
- id string
- The provider-assigned unique ID for this managed resource.
- branch_
protection_ intid - The ID of the branch protection (not the branch name).
- id str
- The provider-assigned unique ID for this managed resource.
- branch
Protection NumberId - The ID of the branch protection (not the branch name).
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing BranchProtection Resource
Get an existing BranchProtection resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: BranchProtectionState, opts?: CustomResourceOptions): BranchProtection@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
allow_force_push: Optional[bool] = None,
allowed_to_merges: Optional[Sequence[BranchProtectionAllowedToMergeArgs]] = None,
allowed_to_pushes: Optional[Sequence[BranchProtectionAllowedToPushArgs]] = None,
allowed_to_unprotects: Optional[Sequence[BranchProtectionAllowedToUnprotectArgs]] = None,
branch: Optional[str] = None,
branch_protection_id: Optional[int] = None,
code_owner_approval_required: Optional[bool] = None,
merge_access_level: Optional[str] = None,
project: Optional[str] = None,
push_access_level: Optional[str] = None) -> BranchProtectionfunc GetBranchProtection(ctx *Context, name string, id IDInput, state *BranchProtectionState, opts ...ResourceOption) (*BranchProtection, error)public static BranchProtection Get(string name, Input<string> id, BranchProtectionState? state, CustomResourceOptions? opts = null)public static BranchProtection get(String name, Output<String> id, BranchProtectionState state, CustomResourceOptions options)resources: _: type: gitlab:BranchProtection get: id: ${id}import {
to = gitlab_branchprotection.example
id = "${id}"
}
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Allow
Force boolPush - Can be set to true to allow users with push access to force push.
- Allowed
To List<Pulumi.Merges Git Lab. Inputs. Branch Protection Allowed To Merge> - Array of merge access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
- Allowed
To List<Pulumi.Pushes Git Lab. Inputs. Branch Protection Allowed To Push> - Array of push access levels/users/groups/deploy keys allowed for the protected branch. Only available for Premium and Ultimate instances.
- Allowed
To List<Pulumi.Unprotects Git Lab. Inputs. Branch Protection Allowed To Unprotect> - Array of unprotect access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
- Branch string
- Name of the branch.
- Branch
Protection intId - The ID of the branch protection (not the branch name).
- Code
Owner boolApproval Required - Can be set to true to require code owner approval before merging. Only available for Premium and Ultimate instances.
- Merge
Access stringLevel - Access levels allowed to merge. Valid values are:
no one,developer,maintainer,admin. Only available for CE instances. - Project string
- The id of the project.
- Push
Access stringLevel - Access levels allowed to push. Valid values are:
no one,developer,maintainer,admin. Only available for CE instances.
- Allow
Force boolPush - Can be set to true to allow users with push access to force push.
- Allowed
To []BranchMerges Protection Allowed To Merge Args - Array of merge access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
- Allowed
To []BranchPushes Protection Allowed To Push Args - Array of push access levels/users/groups/deploy keys allowed for the protected branch. Only available for Premium and Ultimate instances.
- Allowed
To []BranchUnprotects Protection Allowed To Unprotect Args - Array of unprotect access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
- Branch string
- Name of the branch.
- Branch
Protection intId - The ID of the branch protection (not the branch name).
- Code
Owner boolApproval Required - Can be set to true to require code owner approval before merging. Only available for Premium and Ultimate instances.
- Merge
Access stringLevel - Access levels allowed to merge. Valid values are:
no one,developer,maintainer,admin. Only available for CE instances. - Project string
- The id of the project.
- Push
Access stringLevel - Access levels allowed to push. Valid values are:
no one,developer,maintainer,admin. Only available for CE instances.
- allow_
force_ boolpush - Can be set to true to allow users with push access to force push.
- allowed_
to_ list(object)merges - Array of merge access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
- allowed_
to_ list(object)pushes - Array of push access levels/users/groups/deploy keys allowed for the protected branch. Only available for Premium and Ultimate instances.
- allowed_
to_ list(object)unprotects - Array of unprotect access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
- branch string
- Name of the branch.
- branch_
protection_ numberid - The ID of the branch protection (not the branch name).
- code_
owner_ boolapproval_ required - Can be set to true to require code owner approval before merging. Only available for Premium and Ultimate instances.
- merge_
access_ stringlevel - Access levels allowed to merge. Valid values are:
no one,developer,maintainer,admin. Only available for CE instances. - project string
- The id of the project.
- push_
access_ stringlevel - Access levels allowed to push. Valid values are:
no one,developer,maintainer,admin. Only available for CE instances.
- allow
Force BooleanPush - Can be set to true to allow users with push access to force push.
- allowed
To List<BranchMerges Protection Allowed To Merge> - Array of merge access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
- allowed
To List<BranchPushes Protection Allowed To Push> - Array of push access levels/users/groups/deploy keys allowed for the protected branch. Only available for Premium and Ultimate instances.
- allowed
To List<BranchUnprotects Protection Allowed To Unprotect> - Array of unprotect access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
- branch String
- Name of the branch.
- branch
Protection IntegerId - The ID of the branch protection (not the branch name).
- code
Owner BooleanApproval Required - Can be set to true to require code owner approval before merging. Only available for Premium and Ultimate instances.
- merge
Access StringLevel - Access levels allowed to merge. Valid values are:
no one,developer,maintainer,admin. Only available for CE instances. - project String
- The id of the project.
- push
Access StringLevel - Access levels allowed to push. Valid values are:
no one,developer,maintainer,admin. Only available for CE instances.
- allow
Force booleanPush - Can be set to true to allow users with push access to force push.
- allowed
To BranchMerges Protection Allowed To Merge[] - Array of merge access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
- allowed
To BranchPushes Protection Allowed To Push[] - Array of push access levels/users/groups/deploy keys allowed for the protected branch. Only available for Premium and Ultimate instances.
- allowed
To BranchUnprotects Protection Allowed To Unprotect[] - Array of unprotect access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
- branch string
- Name of the branch.
- branch
Protection numberId - The ID of the branch protection (not the branch name).
- code
Owner booleanApproval Required - Can be set to true to require code owner approval before merging. Only available for Premium and Ultimate instances.
- merge
Access stringLevel - Access levels allowed to merge. Valid values are:
no one,developer,maintainer,admin. Only available for CE instances. - project string
- The id of the project.
- push
Access stringLevel - Access levels allowed to push. Valid values are:
no one,developer,maintainer,admin. Only available for CE instances.
- allow_
force_ boolpush - Can be set to true to allow users with push access to force push.
- allowed_
to_ Sequence[Branchmerges Protection Allowed To Merge Args] - Array of merge access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
- allowed_
to_ Sequence[Branchpushes Protection Allowed To Push Args] - Array of push access levels/users/groups/deploy keys allowed for the protected branch. Only available for Premium and Ultimate instances.
- allowed_
to_ Sequence[Branchunprotects Protection Allowed To Unprotect Args] - Array of unprotect access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
- branch str
- Name of the branch.
- branch_
protection_ intid - The ID of the branch protection (not the branch name).
- code_
owner_ boolapproval_ required - Can be set to true to require code owner approval before merging. Only available for Premium and Ultimate instances.
- merge_
access_ strlevel - Access levels allowed to merge. Valid values are:
no one,developer,maintainer,admin. Only available for CE instances. - project str
- The id of the project.
- push_
access_ strlevel - Access levels allowed to push. Valid values are:
no one,developer,maintainer,admin. Only available for CE instances.
- allow
Force BooleanPush - Can be set to true to allow users with push access to force push.
- allowed
To List<Property Map>Merges - Array of merge access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
- allowed
To List<Property Map>Pushes - Array of push access levels/users/groups/deploy keys allowed for the protected branch. Only available for Premium and Ultimate instances.
- allowed
To List<Property Map>Unprotects - Array of unprotect access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
- branch String
- Name of the branch.
- branch
Protection NumberId - The ID of the branch protection (not the branch name).
- code
Owner BooleanApproval Required - Can be set to true to require code owner approval before merging. Only available for Premium and Ultimate instances.
- merge
Access StringLevel - Access levels allowed to merge. Valid values are:
no one,developer,maintainer,admin. Only available for CE instances. - project String
- The id of the project.
- push
Access StringLevel - Access levels allowed to push. Valid values are:
no one,developer,maintainer,admin. Only available for CE instances.
Supporting Types
BranchProtectionAllowedToMerge, BranchProtectionAllowedToMergeArgs
- Access
Level string - Access level allowed to perform the relevant action. Mutually exclusive with
groupIdanduserId. Valid values are:no one,developer,maintainer,admin. - Access
Level stringDescription - Readable description of access level.
- Group
Id int - The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with
userIdandaccessLevel. - User
Id int - The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with
groupIdandaccessLevel.
- Access
Level string - Access level allowed to perform the relevant action. Mutually exclusive with
groupIdanduserId. Valid values are:no one,developer,maintainer,admin. - Access
Level stringDescription - Readable description of access level.
- Group
Id int - The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with
userIdandaccessLevel. - User
Id int - The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with
groupIdandaccessLevel.
- access_
level string - Access level allowed to perform the relevant action. Mutually exclusive with
groupIdanduserId. Valid values are:no one,developer,maintainer,admin. - access_
level_ stringdescription - Readable description of access level.
- group_
id number - The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with
userIdandaccessLevel. - user_
id number - The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with
groupIdandaccessLevel.
- access
Level String - Access level allowed to perform the relevant action. Mutually exclusive with
groupIdanduserId. Valid values are:no one,developer,maintainer,admin. - access
Level StringDescription - Readable description of access level.
- group
Id Integer - The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with
userIdandaccessLevel. - user
Id Integer - The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with
groupIdandaccessLevel.
- access
Level string - Access level allowed to perform the relevant action. Mutually exclusive with
groupIdanduserId. Valid values are:no one,developer,maintainer,admin. - access
Level stringDescription - Readable description of access level.
- group
Id number - The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with
userIdandaccessLevel. - user
Id number - The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with
groupIdandaccessLevel.
- access_
level str - Access level allowed to perform the relevant action. Mutually exclusive with
groupIdanduserId. Valid values are:no one,developer,maintainer,admin. - access_
level_ strdescription - Readable description of access level.
- group_
id int - The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with
userIdandaccessLevel. - user_
id int - The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with
groupIdandaccessLevel.
- access
Level String - Access level allowed to perform the relevant action. Mutually exclusive with
groupIdanduserId. Valid values are:no one,developer,maintainer,admin. - access
Level StringDescription - Readable description of access level.
- group
Id Number - The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with
userIdandaccessLevel. - user
Id Number - The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with
groupIdandaccessLevel.
BranchProtectionAllowedToPush, BranchProtectionAllowedToPushArgs
- Access
Level string - Access level allowed to perform the relevant action. Mutually exclusive with
deployKeyId,groupId, anduserId. Valid values are:no one,developer,maintainer,admin. - Access
Level stringDescription - Readable description of access level.
- Deploy
Key intId - The ID of a GitLab deploy key allowed to perform the relevant action. Mutually exclusive with
userId,groupId, andaccessLevel. This field is read-only until Gitlab 17.5. - Group
Id int - The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with
deployKeyId,userId, andaccessLevel. - User
Id int - The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with
deployKeyId,groupId, andaccessLevel.
- Access
Level string - Access level allowed to perform the relevant action. Mutually exclusive with
deployKeyId,groupId, anduserId. Valid values are:no one,developer,maintainer,admin. - Access
Level stringDescription - Readable description of access level.
- Deploy
Key intId - The ID of a GitLab deploy key allowed to perform the relevant action. Mutually exclusive with
userId,groupId, andaccessLevel. This field is read-only until Gitlab 17.5. - Group
Id int - The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with
deployKeyId,userId, andaccessLevel. - User
Id int - The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with
deployKeyId,groupId, andaccessLevel.
- access_
level string - Access level allowed to perform the relevant action. Mutually exclusive with
deployKeyId,groupId, anduserId. Valid values are:no one,developer,maintainer,admin. - access_
level_ stringdescription - Readable description of access level.
- deploy_
key_ numberid - The ID of a GitLab deploy key allowed to perform the relevant action. Mutually exclusive with
userId,groupId, andaccessLevel. This field is read-only until Gitlab 17.5. - group_
id number - The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with
deployKeyId,userId, andaccessLevel. - user_
id number - The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with
deployKeyId,groupId, andaccessLevel.
- access
Level String - Access level allowed to perform the relevant action. Mutually exclusive with
deployKeyId,groupId, anduserId. Valid values are:no one,developer,maintainer,admin. - access
Level StringDescription - Readable description of access level.
- deploy
Key IntegerId - The ID of a GitLab deploy key allowed to perform the relevant action. Mutually exclusive with
userId,groupId, andaccessLevel. This field is read-only until Gitlab 17.5. - group
Id Integer - The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with
deployKeyId,userId, andaccessLevel. - user
Id Integer - The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with
deployKeyId,groupId, andaccessLevel.
- access
Level string - Access level allowed to perform the relevant action. Mutually exclusive with
deployKeyId,groupId, anduserId. Valid values are:no one,developer,maintainer,admin. - access
Level stringDescription - Readable description of access level.
- deploy
Key numberId - The ID of a GitLab deploy key allowed to perform the relevant action. Mutually exclusive with
userId,groupId, andaccessLevel. This field is read-only until Gitlab 17.5. - group
Id number - The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with
deployKeyId,userId, andaccessLevel. - user
Id number - The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with
deployKeyId,groupId, andaccessLevel.
- access_
level str - Access level allowed to perform the relevant action. Mutually exclusive with
deployKeyId,groupId, anduserId. Valid values are:no one,developer,maintainer,admin. - access_
level_ strdescription - Readable description of access level.
- deploy_
key_ intid - The ID of a GitLab deploy key allowed to perform the relevant action. Mutually exclusive with
userId,groupId, andaccessLevel. This field is read-only until Gitlab 17.5. - group_
id int - The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with
deployKeyId,userId, andaccessLevel. - user_
id int - The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with
deployKeyId,groupId, andaccessLevel.
- access
Level String - Access level allowed to perform the relevant action. Mutually exclusive with
deployKeyId,groupId, anduserId. Valid values are:no one,developer,maintainer,admin. - access
Level StringDescription - Readable description of access level.
- deploy
Key NumberId - The ID of a GitLab deploy key allowed to perform the relevant action. Mutually exclusive with
userId,groupId, andaccessLevel. This field is read-only until Gitlab 17.5. - group
Id Number - The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with
deployKeyId,userId, andaccessLevel. - user
Id Number - The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with
deployKeyId,groupId, andaccessLevel.
BranchProtectionAllowedToUnprotect, BranchProtectionAllowedToUnprotectArgs
- Access
Level string - Access level allowed to perform the relevant action. Mutually exclusive with
groupIdanduserId. Valid values are:developer,maintainer,admin. - Access
Level stringDescription - Readable description of access level.
- Group
Id int - The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with
userIdandaccessLevel. - User
Id int - The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with
groupIdandaccessLevel.
- Access
Level string - Access level allowed to perform the relevant action. Mutually exclusive with
groupIdanduserId. Valid values are:developer,maintainer,admin. - Access
Level stringDescription - Readable description of access level.
- Group
Id int - The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with
userIdandaccessLevel. - User
Id int - The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with
groupIdandaccessLevel.
- access_
level string - Access level allowed to perform the relevant action. Mutually exclusive with
groupIdanduserId. Valid values are:developer,maintainer,admin. - access_
level_ stringdescription - Readable description of access level.
- group_
id number - The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with
userIdandaccessLevel. - user_
id number - The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with
groupIdandaccessLevel.
- access
Level String - Access level allowed to perform the relevant action. Mutually exclusive with
groupIdanduserId. Valid values are:developer,maintainer,admin. - access
Level StringDescription - Readable description of access level.
- group
Id Integer - The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with
userIdandaccessLevel. - user
Id Integer - The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with
groupIdandaccessLevel.
- access
Level string - Access level allowed to perform the relevant action. Mutually exclusive with
groupIdanduserId. Valid values are:developer,maintainer,admin. - access
Level stringDescription - Readable description of access level.
- group
Id number - The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with
userIdandaccessLevel. - user
Id number - The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with
groupIdandaccessLevel.
- access_
level str - Access level allowed to perform the relevant action. Mutually exclusive with
groupIdanduserId. Valid values are:developer,maintainer,admin. - access_
level_ strdescription - Readable description of access level.
- group_
id int - The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with
userIdandaccessLevel. - user_
id int - The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with
groupIdandaccessLevel.
- access
Level String - Access level allowed to perform the relevant action. Mutually exclusive with
groupIdanduserId. Valid values are:developer,maintainer,admin. - access
Level StringDescription - Readable description of access level.
- group
Id Number - The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with
userIdandaccessLevel. - user
Id Number - The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with
groupIdandaccessLevel.
Import
Starting in Terraform v1.5.0, you can use an import block to import gitlab.BranchProtection. For example:
Importing using the CLI is supported with the following syntax:
Gitlab protected branches can be imported with a key composed of <project_id>:<branch>, for example:
$ pulumi import gitlab:index/branchProtection:BranchProtection BranchProtect "12345:main"
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- GitLab pulumi/pulumi-gitlab
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
gitlabTerraform Provider.
published on Friday, Jun 26, 2026 by Pulumi