1. Packages
  2. Packages
  3. Gitlab Provider
  4. API Docs
  5. GroupBranchProtection
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.GroupBranchProtection resource manages the lifecycle of a group-level protected branch.

    This resource requires a GitLab Premium or Ultimate instance.

    Upstream API: GitLab REST API docs

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as gitlab from "@pulumi/gitlab";
    
    // Protect a branch (or wildcard) at the group level. All projects in the group
    // inherit this protection. Requires GitLab Premium or Ultimate.
    const main = new gitlab.GroupBranchProtection("main", {
        group: "12345",
        branch: "main",
        allowForcePush: false,
        codeOwnerApprovalRequired: true,
        allowedToPushes: [
            {
                accessLevel: "maintainer",
            },
            {
                userId: 42,
            },
        ],
        allowedToMerges: [
            {
                accessLevel: "developer",
            },
            {
                groupId: 1337,
            },
        ],
        allowedToUnprotects: [{
            accessLevel: "maintainer",
        }],
    });
    
    import pulumi
    import pulumi_gitlab as gitlab
    
    # Protect a branch (or wildcard) at the group level. All projects in the group
    # inherit this protection. Requires GitLab Premium or Ultimate.
    main = gitlab.GroupBranchProtection("main",
        group="12345",
        branch="main",
        allow_force_push=False,
        code_owner_approval_required=True,
        allowed_to_pushes=[
            {
                "access_level": "maintainer",
            },
            {
                "user_id": 42,
            },
        ],
        allowed_to_merges=[
            {
                "access_level": "developer",
            },
            {
                "group_id": 1337,
            },
        ],
        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 {
    		// Protect a branch (or wildcard) at the group level. All projects in the group
    		// inherit this protection. Requires GitLab Premium or Ultimate.
    		_, err := gitlab.NewGroupBranchProtection(ctx, "main", &gitlab.GroupBranchProtectionArgs{
    			Group:                     pulumi.String("12345"),
    			Branch:                    pulumi.String("main"),
    			AllowForcePush:            pulumi.Bool(false),
    			CodeOwnerApprovalRequired: pulumi.Bool(true),
    			AllowedToPushes: gitlab.GroupBranchProtectionAllowedToPushArray{
    				&gitlab.GroupBranchProtectionAllowedToPushArgs{
    					AccessLevel: pulumi.String("maintainer"),
    				},
    				&gitlab.GroupBranchProtectionAllowedToPushArgs{
    					UserId: pulumi.Int(42),
    				},
    			},
    			AllowedToMerges: gitlab.GroupBranchProtectionAllowedToMergeArray{
    				&gitlab.GroupBranchProtectionAllowedToMergeArgs{
    					AccessLevel: pulumi.String("developer"),
    				},
    				&gitlab.GroupBranchProtectionAllowedToMergeArgs{
    					GroupId: pulumi.Int(1337),
    				},
    			},
    			AllowedToUnprotects: gitlab.GroupBranchProtectionAllowedToUnprotectArray{
    				&gitlab.GroupBranchProtectionAllowedToUnprotectArgs{
    					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(() => 
    {
        // Protect a branch (or wildcard) at the group level. All projects in the group
        // inherit this protection. Requires GitLab Premium or Ultimate.
        var main = new GitLab.GroupBranchProtection("main", new()
        {
            Group = "12345",
            Branch = "main",
            AllowForcePush = false,
            CodeOwnerApprovalRequired = true,
            AllowedToPushes = new[]
            {
                new GitLab.Inputs.GroupBranchProtectionAllowedToPushArgs
                {
                    AccessLevel = "maintainer",
                },
                new GitLab.Inputs.GroupBranchProtectionAllowedToPushArgs
                {
                    UserId = 42,
                },
            },
            AllowedToMerges = new[]
            {
                new GitLab.Inputs.GroupBranchProtectionAllowedToMergeArgs
                {
                    AccessLevel = "developer",
                },
                new GitLab.Inputs.GroupBranchProtectionAllowedToMergeArgs
                {
                    GroupId = 1337,
                },
            },
            AllowedToUnprotects = new[]
            {
                new GitLab.Inputs.GroupBranchProtectionAllowedToUnprotectArgs
                {
                    AccessLevel = "maintainer",
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gitlab.GroupBranchProtection;
    import com.pulumi.gitlab.GroupBranchProtectionArgs;
    import com.pulumi.gitlab.inputs.GroupBranchProtectionAllowedToPushArgs;
    import com.pulumi.gitlab.inputs.GroupBranchProtectionAllowedToMergeArgs;
    import com.pulumi.gitlab.inputs.GroupBranchProtectionAllowedToUnprotectArgs;
    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) {
            // Protect a branch (or wildcard) at the group level. All projects in the group
            // inherit this protection. Requires GitLab Premium or Ultimate.
            var main = new GroupBranchProtection("main", GroupBranchProtectionArgs.builder()
                .group("12345")
                .branch("main")
                .allowForcePush(false)
                .codeOwnerApprovalRequired(true)
                .allowedToPushes(            
                    GroupBranchProtectionAllowedToPushArgs.builder()
                        .accessLevel("maintainer")
                        .build(),
                    GroupBranchProtectionAllowedToPushArgs.builder()
                        .userId(42)
                        .build())
                .allowedToMerges(            
                    GroupBranchProtectionAllowedToMergeArgs.builder()
                        .accessLevel("developer")
                        .build(),
                    GroupBranchProtectionAllowedToMergeArgs.builder()
                        .groupId(1337)
                        .build())
                .allowedToUnprotects(GroupBranchProtectionAllowedToUnprotectArgs.builder()
                    .accessLevel("maintainer")
                    .build())
                .build());
    
        }
    }
    
    resources:
      # Protect a branch (or wildcard) at the group level. All projects in the group
      # inherit this protection. Requires GitLab Premium or Ultimate.
      main:
        type: gitlab:GroupBranchProtection
        properties:
          group: '12345'
          branch: main
          allowForcePush: false
          codeOwnerApprovalRequired: true
          allowedToPushes:
            - accessLevel: maintainer
            - userId: 42
          allowedToMerges:
            - accessLevel: developer
            - groupId: 1337
          allowedToUnprotects:
            - accessLevel: maintainer
    
    pulumi {
      required_providers {
        gitlab = {
          source = "pulumi/gitlab"
        }
      }
    }
    
    # Protect a branch (or wildcard) at the group level. All projects in the group
    # inherit this protection. Requires GitLab Premium or Ultimate.
    resource "gitlab_groupbranchprotection" "main" {
      group                        = "12345"
      branch                       = "main"
      allow_force_push             = false
      code_owner_approval_required = true
      allowed_to_pushes {
        access_level = "maintainer"
      }
      allowed_to_pushes {
        user_id = 42
      }
      allowed_to_merges {
        access_level = "developer"
      }
      allowed_to_merges {
        group_id = 1337
      }
      allowed_to_unprotects {
        access_level = "maintainer"
      }
    }
    

    Create GroupBranchProtection Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new GroupBranchProtection(name: string, args: GroupBranchProtectionArgs, opts?: CustomResourceOptions);
    @overload
    def GroupBranchProtection(resource_name: str,
                              args: GroupBranchProtectionArgs,
                              opts: Optional[ResourceOptions] = None)
    
    @overload
    def GroupBranchProtection(resource_name: str,
                              opts: Optional[ResourceOptions] = None,
                              branch: Optional[str] = None,
                              group: Optional[str] = None,
                              allow_force_push: Optional[bool] = None,
                              allowed_to_merges: Optional[Sequence[GroupBranchProtectionAllowedToMergeArgs]] = None,
                              allowed_to_pushes: Optional[Sequence[GroupBranchProtectionAllowedToPushArgs]] = None,
                              allowed_to_unprotects: Optional[Sequence[GroupBranchProtectionAllowedToUnprotectArgs]] = None,
                              code_owner_approval_required: Optional[bool] = None)
    func NewGroupBranchProtection(ctx *Context, name string, args GroupBranchProtectionArgs, opts ...ResourceOption) (*GroupBranchProtection, error)
    public GroupBranchProtection(string name, GroupBranchProtectionArgs args, CustomResourceOptions? opts = null)
    public GroupBranchProtection(String name, GroupBranchProtectionArgs args)
    public GroupBranchProtection(String name, GroupBranchProtectionArgs args, CustomResourceOptions options)
    
    type: gitlab:GroupBranchProtection
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    resource "gitlab_groupbranchprotection" "name" {
        # resource properties
    }

    Parameters

    name string
    The unique name of the resource.
    args GroupBranchProtectionArgs
    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 GroupBranchProtectionArgs
    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 GroupBranchProtectionArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args GroupBranchProtectionArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args GroupBranchProtectionArgs
    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 groupBranchProtectionResource = new GitLab.GroupBranchProtection("groupBranchProtectionResource", new()
    {
        Branch = "string",
        Group = "string",
        AllowForcePush = false,
        AllowedToMerges = new[]
        {
            new GitLab.Inputs.GroupBranchProtectionAllowedToMergeArgs
            {
                AccessLevel = "string",
                AccessLevelDescription = "string",
                GroupId = 0,
                UserId = 0,
            },
        },
        AllowedToPushes = new[]
        {
            new GitLab.Inputs.GroupBranchProtectionAllowedToPushArgs
            {
                AccessLevel = "string",
                AccessLevelDescription = "string",
                DeployKeyId = 0,
                GroupId = 0,
                UserId = 0,
            },
        },
        AllowedToUnprotects = new[]
        {
            new GitLab.Inputs.GroupBranchProtectionAllowedToUnprotectArgs
            {
                AccessLevel = "string",
                AccessLevelDescription = "string",
                GroupId = 0,
                UserId = 0,
            },
        },
        CodeOwnerApprovalRequired = false,
    });
    
    example, err := gitlab.NewGroupBranchProtection(ctx, "groupBranchProtectionResource", &gitlab.GroupBranchProtectionArgs{
    	Branch:         pulumi.String("string"),
    	Group:          pulumi.String("string"),
    	AllowForcePush: pulumi.Bool(false),
    	AllowedToMerges: gitlab.GroupBranchProtectionAllowedToMergeArray{
    		&gitlab.GroupBranchProtectionAllowedToMergeArgs{
    			AccessLevel:            pulumi.String("string"),
    			AccessLevelDescription: pulumi.String("string"),
    			GroupId:                pulumi.Int(0),
    			UserId:                 pulumi.Int(0),
    		},
    	},
    	AllowedToPushes: gitlab.GroupBranchProtectionAllowedToPushArray{
    		&gitlab.GroupBranchProtectionAllowedToPushArgs{
    			AccessLevel:            pulumi.String("string"),
    			AccessLevelDescription: pulumi.String("string"),
    			DeployKeyId:            pulumi.Int(0),
    			GroupId:                pulumi.Int(0),
    			UserId:                 pulumi.Int(0),
    		},
    	},
    	AllowedToUnprotects: gitlab.GroupBranchProtectionAllowedToUnprotectArray{
    		&gitlab.GroupBranchProtectionAllowedToUnprotectArgs{
    			AccessLevel:            pulumi.String("string"),
    			AccessLevelDescription: pulumi.String("string"),
    			GroupId:                pulumi.Int(0),
    			UserId:                 pulumi.Int(0),
    		},
    	},
    	CodeOwnerApprovalRequired: pulumi.Bool(false),
    })
    
    resource "gitlab_groupbranchprotection" "groupBranchProtectionResource" {
      branch           = "string"
      group            = "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
    }
    
    var groupBranchProtectionResource = new GroupBranchProtection("groupBranchProtectionResource", GroupBranchProtectionArgs.builder()
        .branch("string")
        .group("string")
        .allowForcePush(false)
        .allowedToMerges(GroupBranchProtectionAllowedToMergeArgs.builder()
            .accessLevel("string")
            .accessLevelDescription("string")
            .groupId(0)
            .userId(0)
            .build())
        .allowedToPushes(GroupBranchProtectionAllowedToPushArgs.builder()
            .accessLevel("string")
            .accessLevelDescription("string")
            .deployKeyId(0)
            .groupId(0)
            .userId(0)
            .build())
        .allowedToUnprotects(GroupBranchProtectionAllowedToUnprotectArgs.builder()
            .accessLevel("string")
            .accessLevelDescription("string")
            .groupId(0)
            .userId(0)
            .build())
        .codeOwnerApprovalRequired(false)
        .build());
    
    group_branch_protection_resource = gitlab.GroupBranchProtection("groupBranchProtectionResource",
        branch="string",
        group="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)
    
    const groupBranchProtectionResource = new gitlab.GroupBranchProtection("groupBranchProtectionResource", {
        branch: "string",
        group: "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,
    });
    
    type: gitlab:GroupBranchProtection
    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
        group: string
    

    GroupBranchProtection 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 GroupBranchProtection resource accepts the following input properties:

    Branch string
    Name of the branch or wildcard.
    Group string
    The id or URL-encoded path of the group.
    AllowForcePush bool
    Can be set to true to allow users with push access to force push.
    AllowedToMerges List<Pulumi.GitLab.Inputs.GroupBranchProtectionAllowedToMerge>
    Array of merge access levels/users/groups allowed for the group-level protected branch.
    AllowedToPushes List<Pulumi.GitLab.Inputs.GroupBranchProtectionAllowedToPush>
    Array of push access levels/users/groups/deploy keys allowed for the group-level protected branch.
    AllowedToUnprotects List<Pulumi.GitLab.Inputs.GroupBranchProtectionAllowedToUnprotect>
    Array of unprotect access levels/users/groups allowed for the group-level protected branch.
    CodeOwnerApprovalRequired bool
    Can be set to true to require code owner approval before merging.
    Branch string
    Name of the branch or wildcard.
    Group string
    The id or URL-encoded path of the group.
    AllowForcePush bool
    Can be set to true to allow users with push access to force push.
    AllowedToMerges []GroupBranchProtectionAllowedToMergeArgs
    Array of merge access levels/users/groups allowed for the group-level protected branch.
    AllowedToPushes []GroupBranchProtectionAllowedToPushArgs
    Array of push access levels/users/groups/deploy keys allowed for the group-level protected branch.
    AllowedToUnprotects []GroupBranchProtectionAllowedToUnprotectArgs
    Array of unprotect access levels/users/groups allowed for the group-level protected branch.
    CodeOwnerApprovalRequired bool
    Can be set to true to require code owner approval before merging.
    branch string
    Name of the branch or wildcard.
    group string
    The id or URL-encoded path of the group.
    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 group-level protected branch.
    allowed_to_pushes list(object)
    Array of push access levels/users/groups/deploy keys allowed for the group-level protected branch.
    allowed_to_unprotects list(object)
    Array of unprotect access levels/users/groups allowed for the group-level protected branch.
    code_owner_approval_required bool
    Can be set to true to require code owner approval before merging.
    branch String
    Name of the branch or wildcard.
    group String
    The id or URL-encoded path of the group.
    allowForcePush Boolean
    Can be set to true to allow users with push access to force push.
    allowedToMerges List<GroupBranchProtectionAllowedToMerge>
    Array of merge access levels/users/groups allowed for the group-level protected branch.
    allowedToPushes List<GroupBranchProtectionAllowedToPush>
    Array of push access levels/users/groups/deploy keys allowed for the group-level protected branch.
    allowedToUnprotects List<GroupBranchProtectionAllowedToUnprotect>
    Array of unprotect access levels/users/groups allowed for the group-level protected branch.
    codeOwnerApprovalRequired Boolean
    Can be set to true to require code owner approval before merging.
    branch string
    Name of the branch or wildcard.
    group string
    The id or URL-encoded path of the group.
    allowForcePush boolean
    Can be set to true to allow users with push access to force push.
    allowedToMerges GroupBranchProtectionAllowedToMerge[]
    Array of merge access levels/users/groups allowed for the group-level protected branch.
    allowedToPushes GroupBranchProtectionAllowedToPush[]
    Array of push access levels/users/groups/deploy keys allowed for the group-level protected branch.
    allowedToUnprotects GroupBranchProtectionAllowedToUnprotect[]
    Array of unprotect access levels/users/groups allowed for the group-level protected branch.
    codeOwnerApprovalRequired boolean
    Can be set to true to require code owner approval before merging.
    branch str
    Name of the branch or wildcard.
    group str
    The id or URL-encoded path of the group.
    allow_force_push bool
    Can be set to true to allow users with push access to force push.
    allowed_to_merges Sequence[GroupBranchProtectionAllowedToMergeArgs]
    Array of merge access levels/users/groups allowed for the group-level protected branch.
    allowed_to_pushes Sequence[GroupBranchProtectionAllowedToPushArgs]
    Array of push access levels/users/groups/deploy keys allowed for the group-level protected branch.
    allowed_to_unprotects Sequence[GroupBranchProtectionAllowedToUnprotectArgs]
    Array of unprotect access levels/users/groups allowed for the group-level protected branch.
    code_owner_approval_required bool
    Can be set to true to require code owner approval before merging.
    branch String
    Name of the branch or wildcard.
    group String
    The id or URL-encoded path of the group.
    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 group-level protected branch.
    allowedToPushes List<Property Map>
    Array of push access levels/users/groups/deploy keys allowed for the group-level protected branch.
    allowedToUnprotects List<Property Map>
    Array of unprotect access levels/users/groups allowed for the group-level protected branch.
    codeOwnerApprovalRequired Boolean
    Can be set to true to require code owner approval before merging.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the GroupBranchProtection 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 GroupBranchProtection Resource

    Get an existing GroupBranchProtection 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?: GroupBranchProtectionState, opts?: CustomResourceOptions): GroupBranchProtection
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            allow_force_push: Optional[bool] = None,
            allowed_to_merges: Optional[Sequence[GroupBranchProtectionAllowedToMergeArgs]] = None,
            allowed_to_pushes: Optional[Sequence[GroupBranchProtectionAllowedToPushArgs]] = None,
            allowed_to_unprotects: Optional[Sequence[GroupBranchProtectionAllowedToUnprotectArgs]] = None,
            branch: Optional[str] = None,
            branch_protection_id: Optional[int] = None,
            code_owner_approval_required: Optional[bool] = None,
            group: Optional[str] = None) -> GroupBranchProtection
    func GetGroupBranchProtection(ctx *Context, name string, id IDInput, state *GroupBranchProtectionState, opts ...ResourceOption) (*GroupBranchProtection, error)
    public static GroupBranchProtection Get(string name, Input<string> id, GroupBranchProtectionState? state, CustomResourceOptions? opts = null)
    public static GroupBranchProtection get(String name, Output<String> id, GroupBranchProtectionState state, CustomResourceOptions options)
    resources:  _:    type: gitlab:GroupBranchProtection    get:      id: ${id}
    import {
      to = gitlab_groupbranchprotection.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.GroupBranchProtectionAllowedToMerge>
    Array of merge access levels/users/groups allowed for the group-level protected branch.
    AllowedToPushes List<Pulumi.GitLab.Inputs.GroupBranchProtectionAllowedToPush>
    Array of push access levels/users/groups/deploy keys allowed for the group-level protected branch.
    AllowedToUnprotects List<Pulumi.GitLab.Inputs.GroupBranchProtectionAllowedToUnprotect>
    Array of unprotect access levels/users/groups allowed for the group-level protected branch.
    Branch string
    Name of the branch or wildcard.
    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.
    Group string
    The id or URL-encoded path of the group.
    AllowForcePush bool
    Can be set to true to allow users with push access to force push.
    AllowedToMerges []GroupBranchProtectionAllowedToMergeArgs
    Array of merge access levels/users/groups allowed for the group-level protected branch.
    AllowedToPushes []GroupBranchProtectionAllowedToPushArgs
    Array of push access levels/users/groups/deploy keys allowed for the group-level protected branch.
    AllowedToUnprotects []GroupBranchProtectionAllowedToUnprotectArgs
    Array of unprotect access levels/users/groups allowed for the group-level protected branch.
    Branch string
    Name of the branch or wildcard.
    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.
    Group string
    The id or URL-encoded path of the group.
    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 group-level protected branch.
    allowed_to_pushes list(object)
    Array of push access levels/users/groups/deploy keys allowed for the group-level protected branch.
    allowed_to_unprotects list(object)
    Array of unprotect access levels/users/groups allowed for the group-level protected branch.
    branch string
    Name of the branch or wildcard.
    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.
    group string
    The id or URL-encoded path of the group.
    allowForcePush Boolean
    Can be set to true to allow users with push access to force push.
    allowedToMerges List<GroupBranchProtectionAllowedToMerge>
    Array of merge access levels/users/groups allowed for the group-level protected branch.
    allowedToPushes List<GroupBranchProtectionAllowedToPush>
    Array of push access levels/users/groups/deploy keys allowed for the group-level protected branch.
    allowedToUnprotects List<GroupBranchProtectionAllowedToUnprotect>
    Array of unprotect access levels/users/groups allowed for the group-level protected branch.
    branch String
    Name of the branch or wildcard.
    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.
    group String
    The id or URL-encoded path of the group.
    allowForcePush boolean
    Can be set to true to allow users with push access to force push.
    allowedToMerges GroupBranchProtectionAllowedToMerge[]
    Array of merge access levels/users/groups allowed for the group-level protected branch.
    allowedToPushes GroupBranchProtectionAllowedToPush[]
    Array of push access levels/users/groups/deploy keys allowed for the group-level protected branch.
    allowedToUnprotects GroupBranchProtectionAllowedToUnprotect[]
    Array of unprotect access levels/users/groups allowed for the group-level protected branch.
    branch string
    Name of the branch or wildcard.
    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.
    group string
    The id or URL-encoded path of the group.
    allow_force_push bool
    Can be set to true to allow users with push access to force push.
    allowed_to_merges Sequence[GroupBranchProtectionAllowedToMergeArgs]
    Array of merge access levels/users/groups allowed for the group-level protected branch.
    allowed_to_pushes Sequence[GroupBranchProtectionAllowedToPushArgs]
    Array of push access levels/users/groups/deploy keys allowed for the group-level protected branch.
    allowed_to_unprotects Sequence[GroupBranchProtectionAllowedToUnprotectArgs]
    Array of unprotect access levels/users/groups allowed for the group-level protected branch.
    branch str
    Name of the branch or wildcard.
    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.
    group str
    The id or URL-encoded path of the group.
    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 group-level protected branch.
    allowedToPushes List<Property Map>
    Array of push access levels/users/groups/deploy keys allowed for the group-level protected branch.
    allowedToUnprotects List<Property Map>
    Array of unprotect access levels/users/groups allowed for the group-level protected branch.
    branch String
    Name of the branch or wildcard.
    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.
    group String
    The id or URL-encoded path of the group.

    Supporting Types

    GroupBranchProtectionAllowedToMerge, GroupBranchProtectionAllowedToMergeArgs

    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.

    GroupBranchProtectionAllowedToPush, GroupBranchProtectionAllowedToPushArgs

    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.
    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.
    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.
    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.
    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.
    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.
    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.
    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.

    GroupBranchProtectionAllowedToUnprotect, GroupBranchProtectionAllowedToUnprotectArgs

    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.GroupBranchProtection. For example:

    Importing using the CLI is supported with the following syntax:

    GitLab group-level branch protections can be imported with a key composed of <group-id>:<branch>, for example:

    $ pulumi import gitlab:index/groupBranchProtection:GroupBranchProtection main "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