Pulumi Official
Package maintained by Pulumi
v4.7.0 published on Thursday, Mar 31, 2022 by Pulumi


The gitlab_protected_branch data source allows details of a protected branch to be retrieved by its name and the project it belongs to.

Upstream API: GitLab REST API docs

Example Usage

using Pulumi;
using GitLab = Pulumi.GitLab;

class MyStack : Stack
    public MyStack()
        var example = Output.Create(GitLab.GetProjectProtectedBranch.InvokeAsync(new GitLab.GetProjectProtectedBranchArgs
            Name = "main",
            ProjectId = "foo/bar/baz",

package main

import (

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := gitlab.GetProjectProtectedBranch(ctx, &GetProjectProtectedBranchArgs{
			Name:      "main",
			ProjectId: "foo/bar/baz",
		}, nil)
		if err != nil {
			return err
		return nil

Coming soon!

import pulumi
import pulumi_gitlab as gitlab

example = gitlab.get_project_protected_branch(name="main",
import * as pulumi from "@pulumi/pulumi";
import * as gitlab from "@pulumi/gitlab";

const example = pulumi.output(gitlab.getProjectProtectedBranch({
    name: "main",
    projectId: "foo/bar/baz",

Coming soon!

Using getProjectProtectedBranch

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getProjectProtectedBranch(args: GetProjectProtectedBranchArgs, opts?: InvokeOptions): Promise<GetProjectProtectedBranchResult>
function getProjectProtectedBranchOutput(args: GetProjectProtectedBranchOutputArgs, opts?: InvokeOptions): Output<GetProjectProtectedBranchResult>
def get_project_protected_branch(name: Optional[str] = None,
                                 project_id: Optional[str] = None,
                                 opts: Optional[InvokeOptions] = None) -> GetProjectProtectedBranchResult
def get_project_protected_branch_output(name: Optional[pulumi.Input[str]] = None,
                                 project_id: Optional[pulumi.Input[str]] = None,
                                 opts: Optional[InvokeOptions] = None) -> Output[GetProjectProtectedBranchResult]
func GetProjectProtectedBranch(ctx *Context, args *GetProjectProtectedBranchArgs, opts ...InvokeOption) (*GetProjectProtectedBranchResult, error)
func GetProjectProtectedBranchOutput(ctx *Context, args *GetProjectProtectedBranchOutputArgs, opts ...InvokeOption) GetProjectProtectedBranchResultOutput

> Note: This function is named GetProjectProtectedBranch in the Go SDK.

public static class GetProjectProtectedBranch 
    public static Task<GetProjectProtectedBranchResult> InvokeAsync(GetProjectProtectedBranchArgs args, InvokeOptions? opts = null)
    public static Output<GetProjectProtectedBranchResult> Invoke(GetProjectProtectedBranchInvokeArgs args, InvokeOptions? opts = null)
public static CompletableFuture<GetProjectProtectedBranchResult> getProjectProtectedBranch(GetProjectProtectedBranchArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
  Function: gitlab:index/getProjectProtectedBranch:getProjectProtectedBranch
    # Arguments dictionary

The following arguments are supported:

Name string
ProjectId string
Name string
ProjectId string
name String
projectId String
name string
projectId string
name String
projectId String

getProjectProtectedBranch Result

The following output properties are available:

Supporting Types



Package Details


This Pulumi package is based on the gitlab Terraform Provider.