1. Packages
  2. Gitlab Provider
  3. API Docs
  4. getProjectApprovalRules
GitLab v9.4.0 published on Friday, Oct 17, 2025 by Pulumi

gitlab.getProjectApprovalRules

Deploy with Pulumi
gitlab logo
GitLab v9.4.0 published on Friday, Oct 17, 2025 by Pulumi

    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 dictionary

    The following arguments are supported:

    Project string
    The ID or path with namespace that identifies the project.
    ApprovalRules List<Pulumi.GitLab.Inputs.GetProjectApprovalRulesApprovalRule>
    A list of project approval rules, as defined below.
    Project string
    The ID or path with namespace that identifies the project.
    ApprovalRules []GetProjectApprovalRulesApprovalRule
    A list of project approval rules, as defined below.
    project String
    The ID or path with namespace that identifies the project.
    approvalRules List<GetProjectApprovalRulesApprovalRule>
    A list of project approval rules, as defined below.
    project string
    The ID or path with namespace that identifies the project.
    approvalRules GetProjectApprovalRulesApprovalRule[]
    A list of project approval rules, as defined below.
    project str
    The ID or path with namespace that identifies the project.
    approval_rules Sequence[GetProjectApprovalRulesApprovalRule]
    A list of project approval rules, as defined below.
    project String
    The ID or path with namespace that identifies the project.
    approvalRules 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.
    ApprovalRules List<Pulumi.GitLab.Outputs.GetProjectApprovalRulesApprovalRule>
    A list of project approval rules, as defined below.
    Id string
    Project string
    The ID or path with namespace that identifies the project.
    ApprovalRules []GetProjectApprovalRulesApprovalRule
    A list of project approval rules, as defined below.
    id String
    project String
    The ID or path with namespace that identifies the project.
    approvalRules List<GetProjectApprovalRulesApprovalRule>
    A list of project approval rules, as defined below.
    id string
    project string
    The ID or path with namespace that identifies the project.
    approvalRules GetProjectApprovalRulesApprovalRule[]
    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[GetProjectApprovalRulesApprovalRule]
    A list of project approval rules, as defined below.
    id String
    project String
    The ID or path with namespace that identifies the project.
    approvalRules List<Property Map>
    A list of project approval rules, as defined below.

    Supporting Types

    GetProjectApprovalRulesApprovalRule

    AppliesToAllProtectedBranches bool
    If true, applies the rule to all protected branches, ignoring the protected branches attribute.
    ApprovalsRequired int
    The number of approvals required for this rule.
    EligibleApproverIds List<int>
    List of all approver IDs that are eligible to approve this rule.
    GroupIds 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.
    ProtectedBranchIds List<int>
    List of protected branch IDs that this rule applies to.
    ReportType string
    The report type. Required when the rule type is report_approver. The supported report types are license_scanning and code_coverage.
    RuleType string
    The type of the approval rule. Can be any_approver, regular or report_approver.
    UserIds List<int>
    List of user IDs that are eligible to approve this rule.
    AppliesToAllProtectedBranches bool
    If true, applies the rule to all protected branches, ignoring the protected branches attribute.
    ApprovalsRequired int
    The number of approvals required for this rule.
    EligibleApproverIds []int
    List of all approver IDs that are eligible to approve this rule.
    GroupIds []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.
    ProtectedBranchIds []int
    List of protected branch IDs that this rule applies to.
    ReportType string
    The report type. Required when the rule type is report_approver. The supported report types are license_scanning and code_coverage.
    RuleType string
    The type of the approval rule. Can be any_approver, regular or report_approver.
    UserIds []int
    List of user IDs that are eligible to approve this rule.
    appliesToAllProtectedBranches Boolean
    If true, applies the rule to all protected branches, ignoring the protected branches attribute.
    approvalsRequired Integer
    The number of approvals required for this rule.
    eligibleApproverIds List<Integer>
    List of all approver IDs that are eligible to approve this rule.
    groupIds 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.
    protectedBranchIds List<Integer>
    List of protected branch IDs that this rule applies to.
    reportType String
    The report type. Required when the rule type is report_approver. The supported report types are license_scanning and code_coverage.
    ruleType String
    The type of the approval rule. Can be any_approver, regular or report_approver.
    userIds List<Integer>
    List of user IDs that are eligible to approve this rule.
    appliesToAllProtectedBranches boolean
    If true, applies the rule to all protected branches, ignoring the protected branches attribute.
    approvalsRequired number
    The number of approvals required for this rule.
    eligibleApproverIds number[]
    List of all approver IDs that are eligible to approve this rule.
    groupIds 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.
    protectedBranchIds number[]
    List of protected branch IDs that this rule applies to.
    reportType string
    The report type. Required when the rule type is report_approver. The supported report types are license_scanning and code_coverage.
    ruleType string
    The type of the approval rule. Can be any_approver, regular or report_approver.
    userIds number[]
    List of user IDs that are eligible to approve this rule.
    applies_to_all_protected_branches bool
    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_ids Sequence[int]
    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_ids Sequence[int]
    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 are license_scanning and code_coverage.
    rule_type str
    The type of the approval rule. Can be any_approver, regular or report_approver.
    user_ids Sequence[int]
    List of user IDs that are eligible to approve this rule.
    appliesToAllProtectedBranches Boolean
    If true, applies the rule to all protected branches, ignoring the protected branches attribute.
    approvalsRequired Number
    The number of approvals required for this rule.
    eligibleApproverIds List<Number>
    List of all approver IDs that are eligible to approve this rule.
    groupIds 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.
    protectedBranchIds List<Number>
    List of protected branch IDs that this rule applies to.
    reportType String
    The report type. Required when the rule type is report_approver. The supported report types are license_scanning and code_coverage.
    ruleType String
    The type of the approval rule. Can be any_approver, regular or report_approver.
    userIds 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 gitlab Terraform Provider.
    gitlab logo
    GitLab v9.4.0 published on Friday, Oct 17, 2025 by Pulumi
      Meet Neo: Your AI Platform Teammate