gitlab.Branch
Explore with Pulumi AI
The gitlab.Branch
resource allows to manage the lifecycle of a repository branch.
Upstream API: GitLab REST API docs
Example Usage
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using GitLab = Pulumi.GitLab;
return await Deployment.RunAsync(() =>
{
// Create a project for the branch to use
var exampleProject = new GitLab.Project("exampleProject", new()
{
Description = "An example project",
NamespaceId = gitlab_group.Example.Id,
});
var exampleBranch = new GitLab.Branch("exampleBranch", new()
{
Ref = "main",
Project = exampleProject.Id,
});
});
package main
import (
"github.com/pulumi/pulumi-gitlab/sdk/v6/go/gitlab"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleProject, err := gitlab.NewProject(ctx, "exampleProject", &gitlab.ProjectArgs{
Description: pulumi.String("An example project"),
NamespaceId: pulumi.Any(gitlab_group.Example.Id),
})
if err != nil {
return err
}
_, err = gitlab.NewBranch(ctx, "exampleBranch", &gitlab.BranchArgs{
Ref: pulumi.String("main"),
Project: exampleProject.ID(),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gitlab.Project;
import com.pulumi.gitlab.ProjectArgs;
import com.pulumi.gitlab.Branch;
import com.pulumi.gitlab.BranchArgs;
import java.util.List;
import java.util.ArrayList;
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) {
var exampleProject = new Project("exampleProject", ProjectArgs.builder()
.description("An example project")
.namespaceId(gitlab_group.example().id())
.build());
var exampleBranch = new Branch("exampleBranch", BranchArgs.builder()
.ref("main")
.project(exampleProject.id())
.build());
}
}
import pulumi
import pulumi_gitlab as gitlab
# Create a project for the branch to use
example_project = gitlab.Project("exampleProject",
description="An example project",
namespace_id=gitlab_group["example"]["id"])
example_branch = gitlab.Branch("exampleBranch",
ref="main",
project=example_project.id)
import * as pulumi from "@pulumi/pulumi";
import * as gitlab from "@pulumi/gitlab";
// Create a project for the branch to use
const exampleProject = new gitlab.Project("exampleProject", {
description: "An example project",
namespaceId: gitlab_group.example.id,
});
const exampleBranch = new gitlab.Branch("exampleBranch", {
ref: "main",
project: exampleProject.id,
});
resources:
# Create a project for the branch to use
exampleProject:
type: gitlab:Project
properties:
description: An example project
namespaceId: ${gitlab_group.example.id}
exampleBranch:
type: gitlab:Branch
properties:
ref: main
project: ${exampleProject.id}
Create Branch Resource
new Branch(name: string, args: BranchArgs, opts?: CustomResourceOptions);
@overload
def Branch(resource_name: str,
opts: Optional[ResourceOptions] = None,
name: Optional[str] = None,
project: Optional[str] = None,
ref: Optional[str] = None)
@overload
def Branch(resource_name: str,
args: BranchArgs,
opts: Optional[ResourceOptions] = None)
func NewBranch(ctx *Context, name string, args BranchArgs, opts ...ResourceOption) (*Branch, error)
public Branch(string name, BranchArgs args, CustomResourceOptions? opts = null)
public Branch(String name, BranchArgs args)
public Branch(String name, BranchArgs args, CustomResourceOptions options)
type: gitlab:Branch
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args BranchArgs
- 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 BranchArgs
- 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 BranchArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args BranchArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args BranchArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Branch Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The Branch resource accepts the following input properties:
Outputs
All input properties are implicitly available as output properties. Additionally, the Branch resource produces the following output properties:
- Can
Push bool Bool, true if you can push to the branch.
- Commits
List<Pulumi.
Git Lab. Outputs. Branch Commit> The commit associated with the branch ref.
- Default bool
Bool, true if branch is the default branch for the project.
- Developer
Can boolMerge Bool, true if developer level access allows to merge branch.
- Developer
Can boolPush Bool, true if developer level access allows git push.
- Id string
The provider-assigned unique ID for this managed resource.
- Merged bool
Bool, true if the branch has been merged into it's parent.
- Protected bool
Bool, true if branch has branch protection.
- Web
Url string The url of the created branch (https).
- Can
Push bool Bool, true if you can push to the branch.
- Commits
[]Branch
Commit The commit associated with the branch ref.
- Default bool
Bool, true if branch is the default branch for the project.
- Developer
Can boolMerge Bool, true if developer level access allows to merge branch.
- Developer
Can boolPush Bool, true if developer level access allows git push.
- Id string
The provider-assigned unique ID for this managed resource.
- Merged bool
Bool, true if the branch has been merged into it's parent.
- Protected bool
Bool, true if branch has branch protection.
- Web
Url string The url of the created branch (https).
- can
Push Boolean Bool, true if you can push to the branch.
- commits
List<Branch
Commit> The commit associated with the branch ref.
- default_ Boolean
Bool, true if branch is the default branch for the project.
- developer
Can BooleanMerge Bool, true if developer level access allows to merge branch.
- developer
Can BooleanPush Bool, true if developer level access allows git push.
- id String
The provider-assigned unique ID for this managed resource.
- merged Boolean
Bool, true if the branch has been merged into it's parent.
- protected_ Boolean
Bool, true if branch has branch protection.
- web
Url String The url of the created branch (https).
- can
Push boolean Bool, true if you can push to the branch.
- commits
Branch
Commit[] The commit associated with the branch ref.
- default boolean
Bool, true if branch is the default branch for the project.
- developer
Can booleanMerge Bool, true if developer level access allows to merge branch.
- developer
Can booleanPush Bool, true if developer level access allows git push.
- id string
The provider-assigned unique ID for this managed resource.
- merged boolean
Bool, true if the branch has been merged into it's parent.
- protected boolean
Bool, true if branch has branch protection.
- web
Url string The url of the created branch (https).
- can_
push bool Bool, true if you can push to the branch.
- commits
Sequence[Branch
Commit] The commit associated with the branch ref.
- default bool
Bool, true if branch is the default branch for the project.
- developer_
can_ boolmerge Bool, true if developer level access allows to merge branch.
- developer_
can_ boolpush Bool, true if developer level access allows git push.
- id str
The provider-assigned unique ID for this managed resource.
- merged bool
Bool, true if the branch has been merged into it's parent.
- protected bool
Bool, true if branch has branch protection.
- web_
url str The url of the created branch (https).
- can
Push Boolean Bool, true if you can push to the branch.
- commits List<Property Map>
The commit associated with the branch ref.
- default Boolean
Bool, true if branch is the default branch for the project.
- developer
Can BooleanMerge Bool, true if developer level access allows to merge branch.
- developer
Can BooleanPush Bool, true if developer level access allows git push.
- id String
The provider-assigned unique ID for this managed resource.
- merged Boolean
Bool, true if the branch has been merged into it's parent.
- protected Boolean
Bool, true if branch has branch protection.
- web
Url String The url of the created branch (https).
Look up Existing Branch Resource
Get an existing Branch 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?: BranchState, opts?: CustomResourceOptions): Branch
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
can_push: Optional[bool] = None,
commits: Optional[Sequence[BranchCommitArgs]] = None,
default: Optional[bool] = None,
developer_can_merge: Optional[bool] = None,
developer_can_push: Optional[bool] = None,
merged: Optional[bool] = None,
name: Optional[str] = None,
project: Optional[str] = None,
protected: Optional[bool] = None,
ref: Optional[str] = None,
web_url: Optional[str] = None) -> Branch
func GetBranch(ctx *Context, name string, id IDInput, state *BranchState, opts ...ResourceOption) (*Branch, error)
public static Branch Get(string name, Input<string> id, BranchState? state, CustomResourceOptions? opts = null)
public static Branch get(String name, Output<String> id, BranchState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- 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.
- Can
Push bool Bool, true if you can push to the branch.
- Commits
List<Pulumi.
Git Lab. Inputs. Branch Commit> The commit associated with the branch ref.
- Default bool
Bool, true if branch is the default branch for the project.
- Developer
Can boolMerge Bool, true if developer level access allows to merge branch.
- Developer
Can boolPush Bool, true if developer level access allows git push.
- Merged bool
Bool, true if the branch has been merged into it's parent.
- Name string
The name for this branch.
- Project string
The ID or full path of the project which the branch is created against.
- Protected bool
Bool, true if branch has branch protection.
- Ref string
The ref which the branch is created from.
- Web
Url string The url of the created branch (https).
- Can
Push bool Bool, true if you can push to the branch.
- Commits
[]Branch
Commit Args The commit associated with the branch ref.
- Default bool
Bool, true if branch is the default branch for the project.
- Developer
Can boolMerge Bool, true if developer level access allows to merge branch.
- Developer
Can boolPush Bool, true if developer level access allows git push.
- Merged bool
Bool, true if the branch has been merged into it's parent.
- Name string
The name for this branch.
- Project string
The ID or full path of the project which the branch is created against.
- Protected bool
Bool, true if branch has branch protection.
- Ref string
The ref which the branch is created from.
- Web
Url string The url of the created branch (https).
- can
Push Boolean Bool, true if you can push to the branch.
- commits
List<Branch
Commit> The commit associated with the branch ref.
- default_ Boolean
Bool, true if branch is the default branch for the project.
- developer
Can BooleanMerge Bool, true if developer level access allows to merge branch.
- developer
Can BooleanPush Bool, true if developer level access allows git push.
- merged Boolean
Bool, true if the branch has been merged into it's parent.
- name String
The name for this branch.
- project String
The ID or full path of the project which the branch is created against.
- protected_ Boolean
Bool, true if branch has branch protection.
- ref String
The ref which the branch is created from.
- web
Url String The url of the created branch (https).
- can
Push boolean Bool, true if you can push to the branch.
- commits
Branch
Commit[] The commit associated with the branch ref.
- default boolean
Bool, true if branch is the default branch for the project.
- developer
Can booleanMerge Bool, true if developer level access allows to merge branch.
- developer
Can booleanPush Bool, true if developer level access allows git push.
- merged boolean
Bool, true if the branch has been merged into it's parent.
- name string
The name for this branch.
- project string
The ID or full path of the project which the branch is created against.
- protected boolean
Bool, true if branch has branch protection.
- ref string
The ref which the branch is created from.
- web
Url string The url of the created branch (https).
- can_
push bool Bool, true if you can push to the branch.
- commits
Sequence[Branch
Commit Args] The commit associated with the branch ref.
- default bool
Bool, true if branch is the default branch for the project.
- developer_
can_ boolmerge Bool, true if developer level access allows to merge branch.
- developer_
can_ boolpush Bool, true if developer level access allows git push.
- merged bool
Bool, true if the branch has been merged into it's parent.
- name str
The name for this branch.
- project str
The ID or full path of the project which the branch is created against.
- protected bool
Bool, true if branch has branch protection.
- ref str
The ref which the branch is created from.
- web_
url str The url of the created branch (https).
- can
Push Boolean Bool, true if you can push to the branch.
- commits List<Property Map>
The commit associated with the branch ref.
- default Boolean
Bool, true if branch is the default branch for the project.
- developer
Can BooleanMerge Bool, true if developer level access allows to merge branch.
- developer
Can BooleanPush Bool, true if developer level access allows git push.
- merged Boolean
Bool, true if the branch has been merged into it's parent.
- name String
The name for this branch.
- project String
The ID or full path of the project which the branch is created against.
- protected Boolean
Bool, true if branch has branch protection.
- ref String
The ref which the branch is created from.
- web
Url String The url of the created branch (https).
Supporting Types
BranchCommit, BranchCommitArgs
- string
- string
- string
- Committed
Date string - Committer
Email string - Committer
Name string - Id string
The ID of this resource.
- Message string
- Parent
Ids List<string> - Short
Id string - Title string
- string
- string
- string
- Committed
Date string - Committer
Email string - Committer
Name string - Id string
The ID of this resource.
- Message string
- Parent
Ids []string - Short
Id string - Title string
- String
- String
- String
- committed
Date String - committer
Email String - committer
Name String - id String
The ID of this resource.
- message String
- parent
Ids List<String> - short
Id String - title String
- string
- string
- string
- committed
Date string - committer
Email string - committer
Name string - id string
The ID of this resource.
- message string
- parent
Ids string[] - short
Id string - title string
- str
- str
- str
- committed_
date str - committer_
email str - committer_
name str - id str
The ID of this resource.
- message str
- parent_
ids Sequence[str] - short_
id str - title str
- String
- String
- String
- committed
Date String - committer
Email String - committer
Name String - id String
The ID of this resource.
- message String
- parent
Ids List<String> - short
Id String - title String
Import
Gitlab branches can be imported with a key composed of <project_id>:<branch_name>
, e.g.
$ pulumi import gitlab:index/branch:Branch example "12345:develop"
Package Details
- Repository
- GitLab pulumi/pulumi-gitlab
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
gitlab
Terraform Provider.