GitLab v9.4.0 published on Friday, Oct 17, 2025 by Pulumi
gitlab.getProjectApprovalRules
The gitlab.getProjectApprovalRules data source retrieves all approval rules of a given project.
Upstream API: GitLab REST API docs
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as gitlab from "@pulumi/gitlab";
const byProjectId = gitlab.getProjectApprovalRules({
project: "12345",
});
const byProjectPath = gitlab.getProjectApprovalRules({
project: "my-group/my-project",
});
import pulumi
import pulumi_gitlab as gitlab
by_project_id = gitlab.get_project_approval_rules(project="12345")
by_project_path = gitlab.get_project_approval_rules(project="my-group/my-project")
package main
import (
"github.com/pulumi/pulumi-gitlab/sdk/v9/go/gitlab"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := gitlab.GetProjectApprovalRules(ctx, &gitlab.GetProjectApprovalRulesArgs{
Project: "12345",
}, nil)
if err != nil {
return err
}
_, err = gitlab.GetProjectApprovalRules(ctx, &gitlab.GetProjectApprovalRulesArgs{
Project: "my-group/my-project",
}, nil)
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using GitLab = Pulumi.GitLab;
return await Deployment.RunAsync(() =>
{
var byProjectId = GitLab.GetProjectApprovalRules.Invoke(new()
{
Project = "12345",
});
var byProjectPath = GitLab.GetProjectApprovalRules.Invoke(new()
{
Project = "my-group/my-project",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gitlab.GitlabFunctions;
import com.pulumi.gitlab.inputs.GetProjectApprovalRulesArgs;
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) {
final var byProjectId = GitlabFunctions.getProjectApprovalRules(GetProjectApprovalRulesArgs.builder()
.project("12345")
.build());
final var byProjectPath = GitlabFunctions.getProjectApprovalRules(GetProjectApprovalRulesArgs.builder()
.project("my-group/my-project")
.build());
}
}
variables:
byProjectId:
fn::invoke:
function: gitlab:getProjectApprovalRules
arguments:
project: '12345'
byProjectPath:
fn::invoke:
function: gitlab:getProjectApprovalRules
arguments:
project: my-group/my-project
Using getProjectApprovalRules
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 getProjectApprovalRules(args: GetProjectApprovalRulesArgs, opts?: InvokeOptions): Promise<GetProjectApprovalRulesResult>
function getProjectApprovalRulesOutput(args: GetProjectApprovalRulesOutputArgs, opts?: InvokeOptions): Output<GetProjectApprovalRulesResult>def get_project_approval_rules(approval_rules: Optional[Sequence[GetProjectApprovalRulesApprovalRule]] = None,
project: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetProjectApprovalRulesResult
def get_project_approval_rules_output(approval_rules: Optional[pulumi.Input[Sequence[pulumi.Input[GetProjectApprovalRulesApprovalRuleArgs]]]] = None,
project: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetProjectApprovalRulesResult]func GetProjectApprovalRules(ctx *Context, args *GetProjectApprovalRulesArgs, opts ...InvokeOption) (*GetProjectApprovalRulesResult, error)
func GetProjectApprovalRulesOutput(ctx *Context, args *GetProjectApprovalRulesOutputArgs, opts ...InvokeOption) GetProjectApprovalRulesResultOutput> Note: This function is named GetProjectApprovalRules in the Go SDK.
public static class GetProjectApprovalRules
{
public static Task<GetProjectApprovalRulesResult> InvokeAsync(GetProjectApprovalRulesArgs args, InvokeOptions? opts = null)
public static Output<GetProjectApprovalRulesResult> Invoke(GetProjectApprovalRulesInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetProjectApprovalRulesResult> getProjectApprovalRules(GetProjectApprovalRulesArgs args, InvokeOptions options)
public static Output<GetProjectApprovalRulesResult> getProjectApprovalRules(GetProjectApprovalRulesArgs args, InvokeOptions options)
fn::invoke:
function: gitlab:index/getProjectApprovalRules:getProjectApprovalRules
arguments:
# arguments dictionaryThe following arguments are supported:
- Project string
- The ID or path with namespace that identifies the project.
- Approval
Rules List<Pulumi.Git Lab. Inputs. Get Project Approval Rules Approval Rule> - A list of project approval rules, as defined below.
- Project string
- The ID or path with namespace that identifies the project.
- Approval
Rules []GetProject Approval Rules Approval Rule - A list of project approval rules, as defined below.
- project String
- The ID or path with namespace that identifies the project.
- approval
Rules List<GetProject Approval Rules Approval Rule> - A list of project approval rules, as defined below.
- project string
- The ID or path with namespace that identifies the project.
- approval
Rules GetProject Approval Rules Approval Rule[] - A list of project approval rules, as defined below.
- project str
- The ID or path with namespace that identifies the project.
- approval_
rules Sequence[GetProject Approval Rules Approval Rule] - A list of project approval rules, as defined below.
- project String
- The ID or path with namespace that identifies the project.
- approval
Rules List<Property Map> - A list of project approval rules, as defined below.
getProjectApprovalRules Result
The following output properties are available:
- Id string
- Project string
- The ID or path with namespace that identifies the project.
- Approval
Rules List<Pulumi.Git Lab. Outputs. Get Project Approval Rules Approval Rule> - A list of project approval rules, as defined below.
- Id string
- Project string
- The ID or path with namespace that identifies the project.
- Approval
Rules []GetProject Approval Rules Approval Rule - A list of project approval rules, as defined below.
- id String
- project String
- The ID or path with namespace that identifies the project.
- approval
Rules List<GetProject Approval Rules Approval Rule> - A list of project approval rules, as defined below.
- id string
- project string
- The ID or path with namespace that identifies the project.
- approval
Rules GetProject Approval Rules Approval Rule[] - A list of project approval rules, as defined below.
- id str
- project str
- The ID or path with namespace that identifies the project.
- approval_
rules Sequence[GetProject Approval Rules Approval Rule] - A list of project approval rules, as defined below.
- id String
- project String
- The ID or path with namespace that identifies the project.
- approval
Rules List<Property Map> - A list of project approval rules, as defined below.
Supporting Types
GetProjectApprovalRulesApprovalRule
- Applies
To boolAll Protected Branches - If true, applies the rule to all protected branches, ignoring the protected branches attribute.
- Approvals
Required int - The number of approvals required for this rule.
- Eligible
Approver List<int>Ids - List of all approver IDs that are eligible to approve this rule.
- Group
Ids List<int> - List of group IDs that are eligible to approve this rule.
- Id int
- The ID of the approval rule.
- Name string
- The name of the approval rule.
- Protected
Branch List<int>Ids - List of protected branch IDs that this rule applies to.
- Report
Type string - The report type. Required when the rule type is
report_approver. The supported report types arelicense_scanningandcode_coverage. - Rule
Type string - The type of the approval rule. Can be
any_approver,regularorreport_approver. - User
Ids List<int> - List of user IDs that are eligible to approve this rule.
- Applies
To boolAll Protected Branches - If true, applies the rule to all protected branches, ignoring the protected branches attribute.
- Approvals
Required int - The number of approvals required for this rule.
- Eligible
Approver []intIds - List of all approver IDs that are eligible to approve this rule.
- Group
Ids []int - List of group IDs that are eligible to approve this rule.
- Id int
- The ID of the approval rule.
- Name string
- The name of the approval rule.
- Protected
Branch []intIds - List of protected branch IDs that this rule applies to.
- Report
Type string - The report type. Required when the rule type is
report_approver. The supported report types arelicense_scanningandcode_coverage. - Rule
Type string - The type of the approval rule. Can be
any_approver,regularorreport_approver. - User
Ids []int - List of user IDs that are eligible to approve this rule.
- applies
To BooleanAll Protected Branches - If true, applies the rule to all protected branches, ignoring the protected branches attribute.
- approvals
Required Integer - The number of approvals required for this rule.
- eligible
Approver List<Integer>Ids - List of all approver IDs that are eligible to approve this rule.
- group
Ids List<Integer> - List of group IDs that are eligible to approve this rule.
- id Integer
- The ID of the approval rule.
- name String
- The name of the approval rule.
- protected
Branch List<Integer>Ids - List of protected branch IDs that this rule applies to.
- report
Type String - The report type. Required when the rule type is
report_approver. The supported report types arelicense_scanningandcode_coverage. - rule
Type String - The type of the approval rule. Can be
any_approver,regularorreport_approver. - user
Ids List<Integer> - List of user IDs that are eligible to approve this rule.
- applies
To booleanAll Protected Branches - If true, applies the rule to all protected branches, ignoring the protected branches attribute.
- approvals
Required number - The number of approvals required for this rule.
- eligible
Approver number[]Ids - List of all approver IDs that are eligible to approve this rule.
- group
Ids number[] - List of group IDs that are eligible to approve this rule.
- id number
- The ID of the approval rule.
- name string
- The name of the approval rule.
- protected
Branch number[]Ids - List of protected branch IDs that this rule applies to.
- report
Type string - The report type. Required when the rule type is
report_approver. The supported report types arelicense_scanningandcode_coverage. - rule
Type string - The type of the approval rule. Can be
any_approver,regularorreport_approver. - user
Ids number[] - List of user IDs that are eligible to approve this rule.
- applies_
to_ boolall_ protected_ branches - If true, applies the rule to all protected branches, ignoring the protected branches attribute.
- approvals_
required int - The number of approvals required for this rule.
- eligible_
approver_ Sequence[int]ids - List of all approver IDs that are eligible to approve this rule.
- group_
ids Sequence[int] - List of group IDs that are eligible to approve this rule.
- id int
- The ID of the approval rule.
- name str
- The name of the approval rule.
- protected_
branch_ Sequence[int]ids - List of protected branch IDs that this rule applies to.
- report_
type str - The report type. Required when the rule type is
report_approver. The supported report types arelicense_scanningandcode_coverage. - rule_
type str - The type of the approval rule. Can be
any_approver,regularorreport_approver. - user_
ids Sequence[int] - List of user IDs that are eligible to approve this rule.
- applies
To BooleanAll Protected Branches - If true, applies the rule to all protected branches, ignoring the protected branches attribute.
- approvals
Required Number - The number of approvals required for this rule.
- eligible
Approver List<Number>Ids - List of all approver IDs that are eligible to approve this rule.
- group
Ids List<Number> - List of group IDs that are eligible to approve this rule.
- id Number
- The ID of the approval rule.
- name String
- The name of the approval rule.
- protected
Branch List<Number>Ids - List of protected branch IDs that this rule applies to.
- report
Type String - The report type. Required when the rule type is
report_approver. The supported report types arelicense_scanningandcode_coverage. - rule
Type String - The type of the approval rule. Can be
any_approver,regularorreport_approver. - user
Ids List<Number> - List of user IDs that are eligible to approve this rule.
Package Details
- Repository
- GitLab pulumi/pulumi-gitlab
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
gitlabTerraform Provider.
