1. Registry
  2. Packages
  3. Gitlab Provider
  4. API Docs
  5. ProjectApprovalRules
Viewing docs for GitLab v10.3.0
published on Saturday, Sep 19, 2026 by Pulumi
gitlab logo
Viewing docs for GitLab v10.3.0
published on Saturday, Sep 19, 2026 by Pulumi

    The gitlab.ProjectApprovalRules resource manages the complete set of approval rules of a project.

    This resource requires a GitLab Enterprise instance.

    This resource is authoritative: it manages the entire set of a project’s approval rules. Any approval rule that exists on the project but is not declared in the configuration will be deleted, and such deletions are shown in the plan. If you only need to manage individual rules additively, use the gitlab.ProjectApprovalRule resource instead.

    Managing the anyApprover rule. A project may have at most one rule with ruleType = "anyApprover" (the “all eligible users” rule), and GitLab does not require it to carry any particular name. This resource therefore matches it by ruleType rather than by name, so its name can be chosen freely. A newly created project has no approval rules at all; if you do not declare an anyApprover rule, none is created, and one that already exists is deleted like any other undeclared rule.

    Conflicts with the use of gitlab.ProjectApprovalRule when used on the same project. Use one or the other to ensure the desired state.

    Upstream API: GitLab REST API docs

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as gitlab from "@pulumi/gitlab";
    
    // This resource is authoritative: it manages the *complete* set of a project's approval rules.
    // Any approval rule that exists on the project but is not declared below is deleted.
    const example = new gitlab.ProjectApprovalRules("example", {
        project: "42",
        approvalRules: [
            {
                name: "All eligible users",
                ruleType: "any_approver",
                approvalsRequired: 0,
            },
            {
                name: "Security",
                approvalsRequired: 2,
                ruleType: "regular",
                userIds: [
                    50,
                    51,
                ],
                groupIds: [60],
            },
            {
                name: "Release managers",
                approvalsRequired: 1,
                ruleType: "regular",
                groupIds: [70],
                appliesToAllProtectedBranches: true,
            },
            {
                name: "Coverage-Check",
                approvalsRequired: 1,
                ruleType: "report_approver",
                reportType: "code_coverage",
                userIds: [50],
            },
        ],
    });
    
    import pulumi
    import pulumi_gitlab as gitlab
    
    # This resource is authoritative: it manages the *complete* set of a project's approval rules.
    # Any approval rule that exists on the project but is not declared below is deleted.
    example = gitlab.ProjectApprovalRules("example",
        project="42",
        approval_rules=[
            {
                "name": "All eligible users",
                "rule_type": "any_approver",
                "approvals_required": 0,
            },
            {
                "name": "Security",
                "approvals_required": 2,
                "rule_type": "regular",
                "user_ids": [
                    50,
                    51,
                ],
                "group_ids": [60],
            },
            {
                "name": "Release managers",
                "approvals_required": 1,
                "rule_type": "regular",
                "group_ids": [70],
                "applies_to_all_protected_branches": True,
            },
            {
                "name": "Coverage-Check",
                "approvals_required": 1,
                "rule_type": "report_approver",
                "report_type": "code_coverage",
                "user_ids": [50],
            },
        ])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gitlab/sdk/v10/go/gitlab"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// This resource is authoritative: it manages the *complete* set of a project's approval rules.
    		// Any approval rule that exists on the project but is not declared below is deleted.
    		_, err := gitlab.NewProjectApprovalRules(ctx, "example", &gitlab.ProjectApprovalRulesArgs{
    			Project: pulumi.String("42"),
    			ApprovalRules: gitlab.ProjectApprovalRulesApprovalRuleArray{
    				&gitlab.ProjectApprovalRulesApprovalRuleArgs{
    					Name:              pulumi.String("All eligible users"),
    					RuleType:          pulumi.String("any_approver"),
    					ApprovalsRequired: pulumi.Int(0),
    				},
    				&gitlab.ProjectApprovalRulesApprovalRuleArgs{
    					Name:              pulumi.String("Security"),
    					ApprovalsRequired: pulumi.Int(2),
    					RuleType:          pulumi.String("regular"),
    					UserIds: pulumi.IntArray{
    						pulumi.Int(50),
    						pulumi.Int(51),
    					},
    					GroupIds: pulumi.IntArray{
    						pulumi.Int(60),
    					},
    				},
    				&gitlab.ProjectApprovalRulesApprovalRuleArgs{
    					Name:              pulumi.String("Release managers"),
    					ApprovalsRequired: pulumi.Int(1),
    					RuleType:          pulumi.String("regular"),
    					GroupIds: pulumi.IntArray{
    						pulumi.Int(70),
    					},
    					AppliesToAllProtectedBranches: pulumi.Bool(true),
    				},
    				&gitlab.ProjectApprovalRulesApprovalRuleArgs{
    					Name:              pulumi.String("Coverage-Check"),
    					ApprovalsRequired: pulumi.Int(1),
    					RuleType:          pulumi.String("report_approver"),
    					ReportType:        pulumi.String("code_coverage"),
    					UserIds: pulumi.IntArray{
    						pulumi.Int(50),
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using GitLab = Pulumi.GitLab;
    
    return await Deployment.RunAsync(() => 
    {
        // This resource is authoritative: it manages the *complete* set of a project's approval rules.
        // Any approval rule that exists on the project but is not declared below is deleted.
        var example = new GitLab.ProjectApprovalRules("example", new()
        {
            Project = "42",
            ApprovalRules = new[]
            {
                new GitLab.Inputs.ProjectApprovalRulesApprovalRuleArgs
                {
                    Name = "All eligible users",
                    RuleType = "any_approver",
                    ApprovalsRequired = 0,
                },
                new GitLab.Inputs.ProjectApprovalRulesApprovalRuleArgs
                {
                    Name = "Security",
                    ApprovalsRequired = 2,
                    RuleType = "regular",
                    UserIds = new[]
                    {
                        50,
                        51,
                    },
                    GroupIds = new[]
                    {
                        60,
                    },
                },
                new GitLab.Inputs.ProjectApprovalRulesApprovalRuleArgs
                {
                    Name = "Release managers",
                    ApprovalsRequired = 1,
                    RuleType = "regular",
                    GroupIds = new[]
                    {
                        70,
                    },
                    AppliesToAllProtectedBranches = true,
                },
                new GitLab.Inputs.ProjectApprovalRulesApprovalRuleArgs
                {
                    Name = "Coverage-Check",
                    ApprovalsRequired = 1,
                    RuleType = "report_approver",
                    ReportType = "code_coverage",
                    UserIds = new[]
                    {
                        50,
                    },
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gitlab.ProjectApprovalRules;
    import com.pulumi.gitlab.ProjectApprovalRulesArgs;
    import com.pulumi.gitlab.inputs.ProjectApprovalRulesApprovalRuleArgs;
    import java.util.ArrayList;
    import java.util.Arrays;
    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) {
            // This resource is authoritative: it manages the *complete* set of a project's approval rules.
            // Any approval rule that exists on the project but is not declared below is deleted.
            var example = new ProjectApprovalRules("example", ProjectApprovalRulesArgs.builder()
                .project("42")
                .approvalRules(            
                    ProjectApprovalRulesApprovalRuleArgs.builder()
                        .name("All eligible users")
                        .ruleType("any_approver")
                        .approvalsRequired(0)
                        .build(),
                    ProjectApprovalRulesApprovalRuleArgs.builder()
                        .name("Security")
                        .approvalsRequired(2)
                        .ruleType("regular")
                        .userIds(                    
                            50,
                            51)
                        .groupIds(60)
                        .build(),
                    ProjectApprovalRulesApprovalRuleArgs.builder()
                        .name("Release managers")
                        .approvalsRequired(1)
                        .ruleType("regular")
                        .groupIds(70)
                        .appliesToAllProtectedBranches(true)
                        .build(),
                    ProjectApprovalRulesApprovalRuleArgs.builder()
                        .name("Coverage-Check")
                        .approvalsRequired(1)
                        .ruleType("report_approver")
                        .reportType("code_coverage")
                        .userIds(50)
                        .build())
                .build());
    
        }
    }
    
    resources:
      # This resource is authoritative: it manages the *complete* set of a project's approval rules.
      # Any approval rule that exists on the project but is not declared below is deleted.
      example:
        type: gitlab:ProjectApprovalRules
        properties:
          project: '42'
          approvalRules:
            - name: All eligible users
              ruleType: any_approver
              approvalsRequired: 0
            - name: Security
              approvalsRequired: 2
              ruleType: regular
              userIds:
                - 50
                - 51
              groupIds:
                - 60
            - name: Release managers
              approvalsRequired: 1
              ruleType: regular
              groupIds:
                - 70
              appliesToAllProtectedBranches: true
            - name: Coverage-Check
              approvalsRequired: 1
              ruleType: report_approver
              reportType: code_coverage
              userIds:
                - 50
    
    pulumi {
      required_providers {
        gitlab = {
          source = "pulumi/gitlab"
        }
      }
    }
    
    # This resource is authoritative: it manages the *complete* set of a project's approval rules.
    # Any approval rule that exists on the project but is not declared below is deleted.
    resource "gitlab_projectapprovalrules" "example" {
      project = "42"
      approval_rules {
        name               = "All eligible users"
        rule_type          = "any_approver"
        approvals_required = 0
      }
      approval_rules {
        name               = "Security"
        approvals_required = 2
        rule_type          = "regular"
        user_ids           = [50, 51]
        group_ids          = [60]
      }
      approval_rules {
        name                              = "Release managers"
        approvals_required                = 1
        rule_type                         = "regular"
        group_ids                         = [70]
        applies_to_all_protected_branches = true
      }
      approval_rules {
        name               = "Coverage-Check"
        approvals_required = 1
        rule_type          = "report_approver"
        report_type        = "code_coverage"
        user_ids           = [50]
      }
    }
    

    Create ProjectApprovalRules Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new ProjectApprovalRules(name: string, args: ProjectApprovalRulesArgs, opts?: CustomResourceOptions);
    @overload
    def ProjectApprovalRules(resource_name: str,
                             args: ProjectApprovalRulesArgs,
                             opts: Optional[ResourceOptions] = None)
    
    @overload
    def ProjectApprovalRules(resource_name: str,
                             opts: Optional[ResourceOptions] = None,
                             approval_rules: Optional[Sequence[ProjectApprovalRulesApprovalRuleArgs]] = None,
                             project: Optional[str] = None)
    func NewProjectApprovalRules(ctx *Context, name string, args ProjectApprovalRulesArgs, opts ...ResourceOption) (*ProjectApprovalRules, error)
    public ProjectApprovalRules(string name, ProjectApprovalRulesArgs args, CustomResourceOptions? opts = null)
    public ProjectApprovalRules(String name, ProjectApprovalRulesArgs args)
    public ProjectApprovalRules(String name, ProjectApprovalRulesArgs args, CustomResourceOptions options)
    
    type: gitlab:ProjectApprovalRules
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    resource "gitlab_project_approval_rules" "name" {
        # resource properties
    }

    Parameters

    name string
    The unique name of the resource.
    args ProjectApprovalRulesArgs
    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 ProjectApprovalRulesArgs
    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 ProjectApprovalRulesArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ProjectApprovalRulesArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ProjectApprovalRulesArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var projectApprovalRulesResource = new GitLab.ProjectApprovalRules("projectApprovalRulesResource", new()
    {
        ApprovalRules = new[]
        {
            new GitLab.Inputs.ProjectApprovalRulesApprovalRuleArgs
            {
                ApprovalsRequired = 0,
                Name = "string",
                AppliesToAllProtectedBranches = false,
                GroupIds = new[]
                {
                    0,
                },
                Id = 0,
                ProtectedBranchIds = new[]
                {
                    0,
                },
                ReportType = "string",
                RuleType = "string",
                UserIds = new[]
                {
                    0,
                },
            },
        },
        Project = "string",
    });
    
    example, err := gitlab.NewProjectApprovalRules(ctx, "projectApprovalRulesResource", &gitlab.ProjectApprovalRulesArgs{
    	ApprovalRules: gitlab.ProjectApprovalRulesApprovalRuleArray{
    		&gitlab.ProjectApprovalRulesApprovalRuleArgs{
    			ApprovalsRequired:             pulumi.Int(0),
    			Name:                          pulumi.String("string"),
    			AppliesToAllProtectedBranches: pulumi.Bool(false),
    			GroupIds: pulumi.IntArray{
    				pulumi.Int(0),
    			},
    			Id: pulumi.Int(0),
    			ProtectedBranchIds: pulumi.IntArray{
    				pulumi.Int(0),
    			},
    			ReportType: pulumi.String("string"),
    			RuleType:   pulumi.String("string"),
    			UserIds: pulumi.IntArray{
    				pulumi.Int(0),
    			},
    		},
    	},
    	Project: pulumi.String("string"),
    })
    
    resource "gitlab_project_approval_rules" "projectApprovalRulesResource" {
      lifecycle {
        create_before_destroy = true
      }
      approval_rules {
        approvals_required                = 0
        name                              = "string"
        applies_to_all_protected_branches = false
        group_ids                         = [0]
        id                                = 0
        protected_branch_ids              = [0]
        report_type                       = "string"
        rule_type                         = "string"
        user_ids                          = [0]
      }
      project = "string"
    }
    
    var projectApprovalRulesResource = new ProjectApprovalRules("projectApprovalRulesResource", ProjectApprovalRulesArgs.builder()
        .approvalRules(ProjectApprovalRulesApprovalRuleArgs.builder()
            .approvalsRequired(0)
            .name("string")
            .appliesToAllProtectedBranches(false)
            .groupIds(0)
            .id(0)
            .protectedBranchIds(0)
            .reportType("string")
            .ruleType("string")
            .userIds(0)
            .build())
        .project("string")
        .build());
    
    project_approval_rules_resource = gitlab.ProjectApprovalRules("projectApprovalRulesResource",
        approval_rules=[{
            "approvals_required": 0,
            "name": "string",
            "applies_to_all_protected_branches": False,
            "group_ids": [0],
            "id": 0,
            "protected_branch_ids": [0],
            "report_type": "string",
            "rule_type": "string",
            "user_ids": [0],
        }],
        project="string")
    
    const projectApprovalRulesResource = new gitlab.ProjectApprovalRules("projectApprovalRulesResource", {
        approvalRules: [{
            approvalsRequired: 0,
            name: "string",
            appliesToAllProtectedBranches: false,
            groupIds: [0],
            id: 0,
            protectedBranchIds: [0],
            reportType: "string",
            ruleType: "string",
            userIds: [0],
        }],
        project: "string",
    });
    
    type: gitlab:ProjectApprovalRules
    properties:
        approvalRules:
            - appliesToAllProtectedBranches: false
              approvalsRequired: 0
              groupIds:
                - 0
              id: 0
              name: string
              protectedBranchIds:
                - 0
              reportType: string
              ruleType: string
              userIds:
                - 0
        project: string
    

    ProjectApprovalRules Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The ProjectApprovalRules resource accepts the following input properties:

    ApprovalRules List<Pulumi.GitLab.Inputs.ProjectApprovalRulesApprovalRule>
    The complete set of approval rules of the project. Declaring an empty set removes every approval rule from the project.
    Project string
    The ID or full path of the project.
    ApprovalRules []ProjectApprovalRulesApprovalRuleArgs
    The complete set of approval rules of the project. Declaring an empty set removes every approval rule from the project.
    Project string
    The ID or full path of the project.
    approval_rules list(object)
    The complete set of approval rules of the project. Declaring an empty set removes every approval rule from the project.
    project string
    The ID or full path of the project.
    approvalRules List<ProjectApprovalRulesApprovalRule>
    The complete set of approval rules of the project. Declaring an empty set removes every approval rule from the project.
    project String
    The ID or full path of the project.
    approvalRules ProjectApprovalRulesApprovalRule[]
    The complete set of approval rules of the project. Declaring an empty set removes every approval rule from the project.
    project string
    The ID or full path of the project.
    approval_rules Sequence[ProjectApprovalRulesApprovalRuleArgs]
    The complete set of approval rules of the project. Declaring an empty set removes every approval rule from the project.
    project str
    The ID or full path of the project.
    approvalRules List<Property Map>
    The complete set of approval rules of the project. Declaring an empty set removes every approval rule from the project.
    project String
    The ID or full path of the project.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the ProjectApprovalRules resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing ProjectApprovalRules Resource

    Get an existing ProjectApprovalRules 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?: ProjectApprovalRulesState, opts?: CustomResourceOptions): ProjectApprovalRules
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            approval_rules: Optional[Sequence[ProjectApprovalRulesApprovalRuleArgs]] = None,
            project: Optional[str] = None) -> ProjectApprovalRules
    func GetProjectApprovalRules(ctx *Context, name string, id IDInput, state *ProjectApprovalRulesState, opts ...ResourceOption) (*ProjectApprovalRules, error)
    public static ProjectApprovalRules Get(string name, Input<string> id, ProjectApprovalRulesState? state, CustomResourceOptions? opts = null)
    public static ProjectApprovalRules get(String name, Output<String> id, ProjectApprovalRulesState state, CustomResourceOptions options)
    resources:  _:    type: gitlab:ProjectApprovalRules    get:      id: ${id}
    import {
      to = gitlab_project_approval_rules.example
      id = "${id}"
    }
    
    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.
    The following state arguments are supported:
    ApprovalRules List<Pulumi.GitLab.Inputs.ProjectApprovalRulesApprovalRule>
    The complete set of approval rules of the project. Declaring an empty set removes every approval rule from the project.
    Project string
    The ID or full path of the project.
    ApprovalRules []ProjectApprovalRulesApprovalRuleArgs
    The complete set of approval rules of the project. Declaring an empty set removes every approval rule from the project.
    Project string
    The ID or full path of the project.
    approval_rules list(object)
    The complete set of approval rules of the project. Declaring an empty set removes every approval rule from the project.
    project string
    The ID or full path of the project.
    approvalRules List<ProjectApprovalRulesApprovalRule>
    The complete set of approval rules of the project. Declaring an empty set removes every approval rule from the project.
    project String
    The ID or full path of the project.
    approvalRules ProjectApprovalRulesApprovalRule[]
    The complete set of approval rules of the project. Declaring an empty set removes every approval rule from the project.
    project string
    The ID or full path of the project.
    approval_rules Sequence[ProjectApprovalRulesApprovalRuleArgs]
    The complete set of approval rules of the project. Declaring an empty set removes every approval rule from the project.
    project str
    The ID or full path of the project.
    approvalRules List<Property Map>
    The complete set of approval rules of the project. Declaring an empty set removes every approval rule from the project.
    project String
    The ID or full path of the project.

    Supporting Types

    ProjectApprovalRulesApprovalRule, ProjectApprovalRulesApprovalRuleArgs

    ApprovalsRequired int
    The number of approvals required for this rule.
    Name string
    The name of the approval rule. Names are used to match the configuration to existing rules, so they must be unique among all declared rules other than the anyApprover rule.
    AppliesToAllProtectedBranches bool
    Whether the rule is applied to all protected branches. Conflicts with protectedBranchIds. Defaults to false.
    GroupIds List<int>
    A set of group IDs whose members can approve of the merge request.
    Id int
    The ID of the approval rule.
    ProtectedBranchIds List<int>
    A set of protected branch IDs (not branch names) for which the rule applies. Conflicts with appliesToAllProtectedBranches being set to true.
    ReportType string
    The report type used when the ruleType is reportApprover, in which case it is required. The only value accepted by the GitLab API is codeCoverage, and GitLab reserves the name Coverage-Check for such rules: a codeCoverage rule must use that name, and no other rule may.
    RuleType string
    The type of the rule. Valid values are regular, anyApprover, reportApprover. Defaults to regular. The value is always sent to the API: were it omitted, GitLab would silently create an anyApprover rule instead whenever the rule declares no userIds and no groupIds.
    UserIds List<int>
    A set of specific User IDs to add to the list of approvers.
    ApprovalsRequired int
    The number of approvals required for this rule.
    Name string
    The name of the approval rule. Names are used to match the configuration to existing rules, so they must be unique among all declared rules other than the anyApprover rule.
    AppliesToAllProtectedBranches bool
    Whether the rule is applied to all protected branches. Conflicts with protectedBranchIds. Defaults to false.
    GroupIds []int
    A set of group IDs whose members can approve of the merge request.
    Id int
    The ID of the approval rule.
    ProtectedBranchIds []int
    A set of protected branch IDs (not branch names) for which the rule applies. Conflicts with appliesToAllProtectedBranches being set to true.
    ReportType string
    The report type used when the ruleType is reportApprover, in which case it is required. The only value accepted by the GitLab API is codeCoverage, and GitLab reserves the name Coverage-Check for such rules: a codeCoverage rule must use that name, and no other rule may.
    RuleType string
    The type of the rule. Valid values are regular, anyApprover, reportApprover. Defaults to regular. The value is always sent to the API: were it omitted, GitLab would silently create an anyApprover rule instead whenever the rule declares no userIds and no groupIds.
    UserIds []int
    A set of specific User IDs to add to the list of approvers.
    approvals_required number
    The number of approvals required for this rule.
    name string
    The name of the approval rule. Names are used to match the configuration to existing rules, so they must be unique among all declared rules other than the anyApprover rule.
    applies_to_all_protected_branches bool
    Whether the rule is applied to all protected branches. Conflicts with protectedBranchIds. Defaults to false.
    group_ids list(number)
    A set of group IDs whose members can approve of the merge request.
    id number
    The ID of the approval rule.
    protected_branch_ids list(number)
    A set of protected branch IDs (not branch names) for which the rule applies. Conflicts with appliesToAllProtectedBranches being set to true.
    report_type string
    The report type used when the ruleType is reportApprover, in which case it is required. The only value accepted by the GitLab API is codeCoverage, and GitLab reserves the name Coverage-Check for such rules: a codeCoverage rule must use that name, and no other rule may.
    rule_type string
    The type of the rule. Valid values are regular, anyApprover, reportApprover. Defaults to regular. The value is always sent to the API: were it omitted, GitLab would silently create an anyApprover rule instead whenever the rule declares no userIds and no groupIds.
    user_ids list(number)
    A set of specific User IDs to add to the list of approvers.
    approvalsRequired Integer
    The number of approvals required for this rule.
    name String
    The name of the approval rule. Names are used to match the configuration to existing rules, so they must be unique among all declared rules other than the anyApprover rule.
    appliesToAllProtectedBranches Boolean
    Whether the rule is applied to all protected branches. Conflicts with protectedBranchIds. Defaults to false.
    groupIds List<Integer>
    A set of group IDs whose members can approve of the merge request.
    id Integer
    The ID of the approval rule.
    protectedBranchIds List<Integer>
    A set of protected branch IDs (not branch names) for which the rule applies. Conflicts with appliesToAllProtectedBranches being set to true.
    reportType String
    The report type used when the ruleType is reportApprover, in which case it is required. The only value accepted by the GitLab API is codeCoverage, and GitLab reserves the name Coverage-Check for such rules: a codeCoverage rule must use that name, and no other rule may.
    ruleType String
    The type of the rule. Valid values are regular, anyApprover, reportApprover. Defaults to regular. The value is always sent to the API: were it omitted, GitLab would silently create an anyApprover rule instead whenever the rule declares no userIds and no groupIds.
    userIds List<Integer>
    A set of specific User IDs to add to the list of approvers.
    approvalsRequired number
    The number of approvals required for this rule.
    name string
    The name of the approval rule. Names are used to match the configuration to existing rules, so they must be unique among all declared rules other than the anyApprover rule.
    appliesToAllProtectedBranches boolean
    Whether the rule is applied to all protected branches. Conflicts with protectedBranchIds. Defaults to false.
    groupIds number[]
    A set of group IDs whose members can approve of the merge request.
    id number
    The ID of the approval rule.
    protectedBranchIds number[]
    A set of protected branch IDs (not branch names) for which the rule applies. Conflicts with appliesToAllProtectedBranches being set to true.
    reportType string
    The report type used when the ruleType is reportApprover, in which case it is required. The only value accepted by the GitLab API is codeCoverage, and GitLab reserves the name Coverage-Check for such rules: a codeCoverage rule must use that name, and no other rule may.
    ruleType string
    The type of the rule. Valid values are regular, anyApprover, reportApprover. Defaults to regular. The value is always sent to the API: were it omitted, GitLab would silently create an anyApprover rule instead whenever the rule declares no userIds and no groupIds.
    userIds number[]
    A set of specific User IDs to add to the list of approvers.
    approvals_required int
    The number of approvals required for this rule.
    name str
    The name of the approval rule. Names are used to match the configuration to existing rules, so they must be unique among all declared rules other than the anyApprover rule.
    applies_to_all_protected_branches bool
    Whether the rule is applied to all protected branches. Conflicts with protectedBranchIds. Defaults to false.
    group_ids Sequence[int]
    A set of group IDs whose members can approve of the merge request.
    id int
    The ID of the approval rule.
    protected_branch_ids Sequence[int]
    A set of protected branch IDs (not branch names) for which the rule applies. Conflicts with appliesToAllProtectedBranches being set to true.
    report_type str
    The report type used when the ruleType is reportApprover, in which case it is required. The only value accepted by the GitLab API is codeCoverage, and GitLab reserves the name Coverage-Check for such rules: a codeCoverage rule must use that name, and no other rule may.
    rule_type str
    The type of the rule. Valid values are regular, anyApprover, reportApprover. Defaults to regular. The value is always sent to the API: were it omitted, GitLab would silently create an anyApprover rule instead whenever the rule declares no userIds and no groupIds.
    user_ids Sequence[int]
    A set of specific User IDs to add to the list of approvers.
    approvalsRequired Number
    The number of approvals required for this rule.
    name String
    The name of the approval rule. Names are used to match the configuration to existing rules, so they must be unique among all declared rules other than the anyApprover rule.
    appliesToAllProtectedBranches Boolean
    Whether the rule is applied to all protected branches. Conflicts with protectedBranchIds. Defaults to false.
    groupIds List<Number>
    A set of group IDs whose members can approve of the merge request.
    id Number
    The ID of the approval rule.
    protectedBranchIds List<Number>
    A set of protected branch IDs (not branch names) for which the rule applies. Conflicts with appliesToAllProtectedBranches being set to true.
    reportType String
    The report type used when the ruleType is reportApprover, in which case it is required. The only value accepted by the GitLab API is codeCoverage, and GitLab reserves the name Coverage-Check for such rules: a codeCoverage rule must use that name, and no other rule may.
    ruleType String
    The type of the rule. Valid values are regular, anyApprover, reportApprover. Defaults to regular. The value is always sent to the API: were it omitted, GitLab would silently create an anyApprover rule instead whenever the rule declares no userIds and no groupIds.
    userIds List<Number>
    A set of specific User IDs to add to the list of approvers.

    Import

    Starting in Terraform v1.5.0, you can use an import block to import gitlab.ProjectApprovalRules. For example:

    Importing using the CLI is supported with the following syntax:

    A project’s approval rules can be imported using the project ID or full path, e.g.

    $ pulumi import gitlab:index/projectApprovalRules:ProjectApprovalRules example "42"
    

    or

    $ pulumi import gitlab:index/projectApprovalRules:ProjectApprovalRules example "my-group/my-project"
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    GitLab pulumi/pulumi-gitlab
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the gitlab Terraform Provider.
    gitlab logo
    Viewing docs for GitLab v10.3.0
    published on Saturday, Sep 19, 2026 by Pulumi

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial