The gitlab_branch
data source allows details of a repository branch to be retrieved by its name and project.
Upstream API: GitLab REST API docs
# By project ID
data "gitlab_branch" "foo" {
name = "example"
project = "12345"
}
# By project full path
data "gitlab_branch" "foo" {
name = "example"
project = "foo/bar"
}
name
(String) The name of the branch.project
(String) The full path or id of the project.can_push
(Boolean) Bool, true if you can push to the branch.commit
(Set of Object) The commit associated with the branch ref. (see below for nested schema)default
(Boolean) Bool, true if branch is the default branch for the project.developer_can_merge
(Boolean) Bool, true if developer level access allows to merge branch.developer_can_push
(Boolean) Bool, true if developer level access allows git push.id
(String) The ID of this 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.)commit
Read-Only:
author_email
(String)author_name
(String)authored_date
(String)committed_date
(String)committer_email
(String)committer_name
(String)id
(String)message
(String)parent_ids
(Set of String)short_id
(String)title
(String)