The gitlab_project_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
data "gitlab_project_protected_branch" "example" {
project_id = 30
name = "main"
}
data "gitlab_project_protected_branch" "example" {
project_id = "foo/bar/baz"
name = "main"
}
name
(String) The name of the protected branch.project_id
(String) The integer or path with namespace that uniquely identifies the project.merge_access_levels
(Block Set) Array of access levels and user(s)/group(s) allowed to merge to protected branch. (see below for nested schema)push_access_levels
(Block Set) Array of access levels and user(s)/group(s) allowed to push to protected branch. (see below for nested schema)allow_force_push
(Boolean) Whether force push is allowed.code_owner_approval_required
(Boolean) Reject code pushes that change files listed in the CODEOWNERS file.id
(Number) The ID of this resource.merge_access_levels
Optional:
group_id
(Number) The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with user_id
.user_id
(Number) The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with group_id
.Read-Only:
access_level
(String) Access levels allowed to merge to protected branch. Valid values are: no one
, developer
, maintainer
.access_level_description
(String) Readable description of access level.push_access_levels
Optional:
group_id
(Number) The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with user_id
.user_id
(Number) The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with group_id
.Read-Only:
access_level
(String) Access levels allowed to push to protected branch. Valid values are: no one
, developer
, maintainer
.access_level_description
(String) Readable description of access level.