1. Packages
  2. Packages
  3. Gitlab Provider
  4. API Docs
  5. BranchProtection
Viewing docs for GitLab v10.0.0
published on Friday, Jun 26, 2026 by Pulumi
gitlab logo
Viewing docs for GitLab v10.0.0
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.BranchProtection resource will automatically take ownership of the default branch without an explicit import by unprotecting and properly protecting it again. Having multiple gitlab.BranchProtection resources 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, allowedToUnprotect and codeOwnerApprovalRequired attributes require a GitLab Enterprise instance.

    The mergeAccessLevel and pushAccessLevel attributes are not available for GitLab Enterprise. Use allowedToMerge and allowedToPush instead.

    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.
    AllowForcePush bool
    Can be set to true to allow users with push access to force push.
    AllowedToMerges List<Pulumi.GitLab.Inputs.BranchProtectionAllowedToMerge>
    Array of merge access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
    AllowedToPushes List<Pulumi.GitLab.Inputs.BranchProtectionAllowedToPush>
    Array of push access levels/users/groups/deploy keys allowed for the protected branch. Only available for Premium and Ultimate instances.
    AllowedToUnprotects List<Pulumi.GitLab.Inputs.BranchProtectionAllowedToUnprotect>
    Array of unprotect access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
    CodeOwnerApprovalRequired bool
    Can be set to true to require code owner approval before merging. Only available for Premium and Ultimate instances.
    MergeAccessLevel string
    Access levels allowed to merge. Valid values are: no one, developer, maintainer, admin. Only available for CE instances.
    PushAccessLevel string
    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.
    AllowForcePush bool
    Can be set to true to allow users with push access to force push.
    AllowedToMerges []BranchProtectionAllowedToMergeArgs
    Array of merge access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
    AllowedToPushes []BranchProtectionAllowedToPushArgs
    Array of push access levels/users/groups/deploy keys allowed for the protected branch. Only available for Premium and Ultimate instances.
    AllowedToUnprotects []BranchProtectionAllowedToUnprotectArgs
    Array of unprotect access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
    CodeOwnerApprovalRequired bool
    Can be set to true to require code owner approval before merging. Only available for Premium and Ultimate instances.
    MergeAccessLevel string
    Access levels allowed to merge. Valid values are: no one, developer, maintainer, admin. Only available for CE instances.
    PushAccessLevel string
    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_push bool
    Can be set to true to allow users with push access to force push.
    allowed_to_merges list(object)
    Array of merge access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
    allowed_to_pushes list(object)
    Array of push access levels/users/groups/deploy keys allowed for the protected branch. Only available for Premium and Ultimate instances.
    allowed_to_unprotects list(object)
    Array of unprotect access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
    code_owner_approval_required bool
    Can be set to true to require code owner approval before merging. Only available for Premium and Ultimate instances.
    merge_access_level string
    Access levels allowed to merge. Valid values are: no one, developer, maintainer, admin. Only available for CE instances.
    push_access_level string
    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.
    allowForcePush Boolean
    Can be set to true to allow users with push access to force push.
    allowedToMerges List<BranchProtectionAllowedToMerge>
    Array of merge access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
    allowedToPushes List<BranchProtectionAllowedToPush>
    Array of push access levels/users/groups/deploy keys allowed for the protected branch. Only available for Premium and Ultimate instances.
    allowedToUnprotects List<BranchProtectionAllowedToUnprotect>
    Array of unprotect access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
    codeOwnerApprovalRequired Boolean
    Can be set to true to require code owner approval before merging. Only available for Premium and Ultimate instances.
    mergeAccessLevel String
    Access levels allowed to merge. Valid values are: no one, developer, maintainer, admin. Only available for CE instances.
    pushAccessLevel String
    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.
    allowForcePush boolean
    Can be set to true to allow users with push access to force push.
    allowedToMerges BranchProtectionAllowedToMerge[]
    Array of merge access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
    allowedToPushes BranchProtectionAllowedToPush[]
    Array of push access levels/users/groups/deploy keys allowed for the protected branch. Only available for Premium and Ultimate instances.
    allowedToUnprotects BranchProtectionAllowedToUnprotect[]
    Array of unprotect access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
    codeOwnerApprovalRequired boolean
    Can be set to true to require code owner approval before merging. Only available for Premium and Ultimate instances.
    mergeAccessLevel string
    Access levels allowed to merge. Valid values are: no one, developer, maintainer, admin. Only available for CE instances.
    pushAccessLevel string
    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_push bool
    Can be set to true to allow users with push access to force push.
    allowed_to_merges Sequence[BranchProtectionAllowedToMergeArgs]
    Array of merge access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
    allowed_to_pushes Sequence[BranchProtectionAllowedToPushArgs]
    Array of push access levels/users/groups/deploy keys allowed for the protected branch. Only available for Premium and Ultimate instances.
    allowed_to_unprotects Sequence[BranchProtectionAllowedToUnprotectArgs]
    Array of unprotect access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
    code_owner_approval_required bool
    Can be set to true to require code owner approval before merging. Only available for Premium and Ultimate instances.
    merge_access_level str
    Access levels allowed to merge. Valid values are: no one, developer, maintainer, admin. Only available for CE instances.
    push_access_level str
    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.
    allowForcePush Boolean
    Can be set to true to allow users with push access to force push.
    allowedToMerges List<Property Map>
    Array of merge access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
    allowedToPushes List<Property Map>
    Array of push access levels/users/groups/deploy keys allowed for the protected branch. Only available for Premium and Ultimate instances.
    allowedToUnprotects List<Property Map>
    Array of unprotect access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
    codeOwnerApprovalRequired Boolean
    Can be set to true to require code owner approval before merging. Only available for Premium and Ultimate instances.
    mergeAccessLevel String
    Access levels allowed to merge. Valid values are: no one, developer, maintainer, admin. Only available for CE instances.
    pushAccessLevel String
    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:

    BranchProtectionId int
    The ID of the branch protection (not the branch name).
    Id string
    The provider-assigned unique ID for this managed resource.
    BranchProtectionId int
    The ID of the branch protection (not the branch name).
    Id string
    The provider-assigned unique ID for this managed resource.
    branch_protection_id number
    The ID of the branch protection (not the branch name).
    id string
    The provider-assigned unique ID for this managed resource.
    branchProtectionId Integer
    The ID of the branch protection (not the branch name).
    id String
    The provider-assigned unique ID for this managed resource.
    branchProtectionId number
    The ID of the branch protection (not the branch name).
    id string
    The provider-assigned unique ID for this managed resource.
    branch_protection_id int
    The ID of the branch protection (not the branch name).
    id str
    The provider-assigned unique ID for this managed resource.
    branchProtectionId Number
    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) -> BranchProtection
    func 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.
    The following state arguments are supported:
    AllowForcePush bool
    Can be set to true to allow users with push access to force push.
    AllowedToMerges List<Pulumi.GitLab.Inputs.BranchProtectionAllowedToMerge>
    Array of merge access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
    AllowedToPushes List<Pulumi.GitLab.Inputs.BranchProtectionAllowedToPush>
    Array of push access levels/users/groups/deploy keys allowed for the protected branch. Only available for Premium and Ultimate instances.
    AllowedToUnprotects List<Pulumi.GitLab.Inputs.BranchProtectionAllowedToUnprotect>
    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.
    BranchProtectionId int
    The ID of the branch protection (not the branch name).
    CodeOwnerApprovalRequired bool
    Can be set to true to require code owner approval before merging. Only available for Premium and Ultimate instances.
    MergeAccessLevel string
    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.
    PushAccessLevel string
    Access levels allowed to push. Valid values are: no one, developer, maintainer, admin. Only available for CE instances.
    AllowForcePush bool
    Can be set to true to allow users with push access to force push.
    AllowedToMerges []BranchProtectionAllowedToMergeArgs
    Array of merge access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
    AllowedToPushes []BranchProtectionAllowedToPushArgs
    Array of push access levels/users/groups/deploy keys allowed for the protected branch. Only available for Premium and Ultimate instances.
    AllowedToUnprotects []BranchProtectionAllowedToUnprotectArgs
    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.
    BranchProtectionId int
    The ID of the branch protection (not the branch name).
    CodeOwnerApprovalRequired bool
    Can be set to true to require code owner approval before merging. Only available for Premium and Ultimate instances.
    MergeAccessLevel string
    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.
    PushAccessLevel string
    Access levels allowed to push. Valid values are: no one, developer, maintainer, admin. Only available for CE instances.
    allow_force_push bool
    Can be set to true to allow users with push access to force push.
    allowed_to_merges list(object)
    Array of merge access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
    allowed_to_pushes list(object)
    Array of push access levels/users/groups/deploy keys allowed for the protected branch. Only available for Premium and Ultimate instances.
    allowed_to_unprotects list(object)
    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_id number
    The ID of the branch protection (not the branch name).
    code_owner_approval_required bool
    Can be set to true to require code owner approval before merging. Only available for Premium and Ultimate instances.
    merge_access_level string
    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_level string
    Access levels allowed to push. Valid values are: no one, developer, maintainer, admin. Only available for CE instances.
    allowForcePush Boolean
    Can be set to true to allow users with push access to force push.
    allowedToMerges List<BranchProtectionAllowedToMerge>
    Array of merge access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
    allowedToPushes List<BranchProtectionAllowedToPush>
    Array of push access levels/users/groups/deploy keys allowed for the protected branch. Only available for Premium and Ultimate instances.
    allowedToUnprotects List<BranchProtectionAllowedToUnprotect>
    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.
    branchProtectionId Integer
    The ID of the branch protection (not the branch name).
    codeOwnerApprovalRequired Boolean
    Can be set to true to require code owner approval before merging. Only available for Premium and Ultimate instances.
    mergeAccessLevel String
    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.
    pushAccessLevel String
    Access levels allowed to push. Valid values are: no one, developer, maintainer, admin. Only available for CE instances.
    allowForcePush boolean
    Can be set to true to allow users with push access to force push.
    allowedToMerges BranchProtectionAllowedToMerge[]
    Array of merge access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
    allowedToPushes BranchProtectionAllowedToPush[]
    Array of push access levels/users/groups/deploy keys allowed for the protected branch. Only available for Premium and Ultimate instances.
    allowedToUnprotects BranchProtectionAllowedToUnprotect[]
    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.
    branchProtectionId number
    The ID of the branch protection (not the branch name).
    codeOwnerApprovalRequired boolean
    Can be set to true to require code owner approval before merging. Only available for Premium and Ultimate instances.
    mergeAccessLevel string
    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.
    pushAccessLevel string
    Access levels allowed to push. Valid values are: no one, developer, maintainer, admin. Only available for CE instances.
    allow_force_push bool
    Can be set to true to allow users with push access to force push.
    allowed_to_merges Sequence[BranchProtectionAllowedToMergeArgs]
    Array of merge access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
    allowed_to_pushes Sequence[BranchProtectionAllowedToPushArgs]
    Array of push access levels/users/groups/deploy keys allowed for the protected branch. Only available for Premium and Ultimate instances.
    allowed_to_unprotects Sequence[BranchProtectionAllowedToUnprotectArgs]
    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_id int
    The ID of the branch protection (not the branch name).
    code_owner_approval_required bool
    Can be set to true to require code owner approval before merging. Only available for Premium and Ultimate instances.
    merge_access_level str
    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_level str
    Access levels allowed to push. Valid values are: no one, developer, maintainer, admin. Only available for CE instances.
    allowForcePush Boolean
    Can be set to true to allow users with push access to force push.
    allowedToMerges List<Property Map>
    Array of merge access levels/users/groups allowed for the protected branch. Only available for Premium and Ultimate instances.
    allowedToPushes List<Property Map>
    Array of push access levels/users/groups/deploy keys allowed for the protected branch. Only available for Premium and Ultimate instances.
    allowedToUnprotects List<Property Map>
    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.
    branchProtectionId Number
    The ID of the branch protection (not the branch name).
    codeOwnerApprovalRequired Boolean
    Can be set to true to require code owner approval before merging. Only available for Premium and Ultimate instances.
    mergeAccessLevel String
    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.
    pushAccessLevel String
    Access levels allowed to push. Valid values are: no one, developer, maintainer, admin. Only available for CE instances.

    Supporting Types

    BranchProtectionAllowedToMerge, BranchProtectionAllowedToMergeArgs

    AccessLevel string
    Access level allowed to perform the relevant action. Mutually exclusive with groupId and userId. Valid values are: no one, developer, maintainer, admin.
    AccessLevelDescription string
    Readable description of access level.
    GroupId int
    The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with userId and accessLevel.
    UserId int
    The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with groupId and accessLevel.
    AccessLevel string
    Access level allowed to perform the relevant action. Mutually exclusive with groupId and userId. Valid values are: no one, developer, maintainer, admin.
    AccessLevelDescription string
    Readable description of access level.
    GroupId int
    The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with userId and accessLevel.
    UserId int
    The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with groupId and accessLevel.
    access_level string
    Access level allowed to perform the relevant action. Mutually exclusive with groupId and userId. Valid values are: no one, developer, maintainer, admin.
    access_level_description string
    Readable description of access level.
    group_id number
    The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with userId and accessLevel.
    user_id number
    The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with groupId and accessLevel.
    accessLevel String
    Access level allowed to perform the relevant action. Mutually exclusive with groupId and userId. Valid values are: no one, developer, maintainer, admin.
    accessLevelDescription String
    Readable description of access level.
    groupId Integer
    The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with userId and accessLevel.
    userId Integer
    The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with groupId and accessLevel.
    accessLevel string
    Access level allowed to perform the relevant action. Mutually exclusive with groupId and userId. Valid values are: no one, developer, maintainer, admin.
    accessLevelDescription string
    Readable description of access level.
    groupId number
    The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with userId and accessLevel.
    userId number
    The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with groupId and accessLevel.
    access_level str
    Access level allowed to perform the relevant action. Mutually exclusive with groupId and userId. Valid values are: no one, developer, maintainer, admin.
    access_level_description str
    Readable description of access level.
    group_id int
    The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with userId and accessLevel.
    user_id int
    The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with groupId and accessLevel.
    accessLevel String
    Access level allowed to perform the relevant action. Mutually exclusive with groupId and userId. Valid values are: no one, developer, maintainer, admin.
    accessLevelDescription String
    Readable description of access level.
    groupId Number
    The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with userId and accessLevel.
    userId Number
    The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with groupId and accessLevel.

    BranchProtectionAllowedToPush, BranchProtectionAllowedToPushArgs

    AccessLevel string
    Access level allowed to perform the relevant action. Mutually exclusive with deployKeyId, groupId, and userId. Valid values are: no one, developer, maintainer, admin.
    AccessLevelDescription string
    Readable description of access level.
    DeployKeyId int
    The ID of a GitLab deploy key allowed to perform the relevant action. Mutually exclusive with userId, groupId, and accessLevel. This field is read-only until Gitlab 17.5.
    GroupId int
    The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with deployKeyId, userId, and accessLevel.
    UserId int
    The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with deployKeyId, groupId, and accessLevel.
    AccessLevel string
    Access level allowed to perform the relevant action. Mutually exclusive with deployKeyId, groupId, and userId. Valid values are: no one, developer, maintainer, admin.
    AccessLevelDescription string
    Readable description of access level.
    DeployKeyId int
    The ID of a GitLab deploy key allowed to perform the relevant action. Mutually exclusive with userId, groupId, and accessLevel. This field is read-only until Gitlab 17.5.
    GroupId int
    The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with deployKeyId, userId, and accessLevel.
    UserId int
    The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with deployKeyId, groupId, and accessLevel.
    access_level string
    Access level allowed to perform the relevant action. Mutually exclusive with deployKeyId, groupId, and userId. Valid values are: no one, developer, maintainer, admin.
    access_level_description string
    Readable description of access level.
    deploy_key_id number
    The ID of a GitLab deploy key allowed to perform the relevant action. Mutually exclusive with userId, groupId, and accessLevel. 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, and accessLevel.
    user_id number
    The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with deployKeyId, groupId, and accessLevel.
    accessLevel String
    Access level allowed to perform the relevant action. Mutually exclusive with deployKeyId, groupId, and userId. Valid values are: no one, developer, maintainer, admin.
    accessLevelDescription String
    Readable description of access level.
    deployKeyId Integer
    The ID of a GitLab deploy key allowed to perform the relevant action. Mutually exclusive with userId, groupId, and accessLevel. This field is read-only until Gitlab 17.5.
    groupId Integer
    The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with deployKeyId, userId, and accessLevel.
    userId Integer
    The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with deployKeyId, groupId, and accessLevel.
    accessLevel string
    Access level allowed to perform the relevant action. Mutually exclusive with deployKeyId, groupId, and userId. Valid values are: no one, developer, maintainer, admin.
    accessLevelDescription string
    Readable description of access level.
    deployKeyId number
    The ID of a GitLab deploy key allowed to perform the relevant action. Mutually exclusive with userId, groupId, and accessLevel. This field is read-only until Gitlab 17.5.
    groupId number
    The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with deployKeyId, userId, and accessLevel.
    userId number
    The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with deployKeyId, groupId, and accessLevel.
    access_level str
    Access level allowed to perform the relevant action. Mutually exclusive with deployKeyId, groupId, and userId. Valid values are: no one, developer, maintainer, admin.
    access_level_description str
    Readable description of access level.
    deploy_key_id int
    The ID of a GitLab deploy key allowed to perform the relevant action. Mutually exclusive with userId, groupId, and accessLevel. 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, and accessLevel.
    user_id int
    The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with deployKeyId, groupId, and accessLevel.
    accessLevel String
    Access level allowed to perform the relevant action. Mutually exclusive with deployKeyId, groupId, and userId. Valid values are: no one, developer, maintainer, admin.
    accessLevelDescription String
    Readable description of access level.
    deployKeyId Number
    The ID of a GitLab deploy key allowed to perform the relevant action. Mutually exclusive with userId, groupId, and accessLevel. This field is read-only until Gitlab 17.5.
    groupId Number
    The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with deployKeyId, userId, and accessLevel.
    userId Number
    The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with deployKeyId, groupId, and accessLevel.

    BranchProtectionAllowedToUnprotect, BranchProtectionAllowedToUnprotectArgs

    AccessLevel string
    Access level allowed to perform the relevant action. Mutually exclusive with groupId and userId. Valid values are: developer, maintainer, admin.
    AccessLevelDescription string
    Readable description of access level.
    GroupId int
    The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with userId and accessLevel.
    UserId int
    The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with groupId and accessLevel.
    AccessLevel string
    Access level allowed to perform the relevant action. Mutually exclusive with groupId and userId. Valid values are: developer, maintainer, admin.
    AccessLevelDescription string
    Readable description of access level.
    GroupId int
    The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with userId and accessLevel.
    UserId int
    The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with groupId and accessLevel.
    access_level string
    Access level allowed to perform the relevant action. Mutually exclusive with groupId and userId. Valid values are: developer, maintainer, admin.
    access_level_description string
    Readable description of access level.
    group_id number
    The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with userId and accessLevel.
    user_id number
    The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with groupId and accessLevel.
    accessLevel String
    Access level allowed to perform the relevant action. Mutually exclusive with groupId and userId. Valid values are: developer, maintainer, admin.
    accessLevelDescription String
    Readable description of access level.
    groupId Integer
    The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with userId and accessLevel.
    userId Integer
    The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with groupId and accessLevel.
    accessLevel string
    Access level allowed to perform the relevant action. Mutually exclusive with groupId and userId. Valid values are: developer, maintainer, admin.
    accessLevelDescription string
    Readable description of access level.
    groupId number
    The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with userId and accessLevel.
    userId number
    The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with groupId and accessLevel.
    access_level str
    Access level allowed to perform the relevant action. Mutually exclusive with groupId and userId. Valid values are: developer, maintainer, admin.
    access_level_description str
    Readable description of access level.
    group_id int
    The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with userId and accessLevel.
    user_id int
    The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with groupId and accessLevel.
    accessLevel String
    Access level allowed to perform the relevant action. Mutually exclusive with groupId and userId. Valid values are: developer, maintainer, admin.
    accessLevelDescription String
    Readable description of access level.
    groupId Number
    The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with userId and accessLevel.
    userId Number
    The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with groupId and accessLevel.

    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 gitlab Terraform Provider.
    gitlab logo
    Viewing docs for GitLab v10.0.0
    published on Friday, Jun 26, 2026 by Pulumi

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial