gcp.securesourcemanager.BranchRule
Explore with Pulumi AI
BranchRule is the protection rule to enforce pre-defined rules on designated branches within a repository.
To get more information about BranchRule, see:
- API documentation
- How-to Guides
Example Usage
Secure Source Manager Branch Rule Basic
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const instance = new gcp.securesourcemanager.Instance("instance", {
    location: "us-central1",
    instanceId: "my-basic-instance",
});
const repository = new gcp.securesourcemanager.Repository("repository", {
    repositoryId: "my-basic-repository",
    location: instance.location,
    instance: instance.name,
});
const basic = new gcp.securesourcemanager.BranchRule("basic", {
    branchRuleId: "my-basic-branchrule",
    repositoryId: repository.repositoryId,
    location: repository.location,
    includePattern: "main",
});
import pulumi
import pulumi_gcp as gcp
instance = gcp.securesourcemanager.Instance("instance",
    location="us-central1",
    instance_id="my-basic-instance")
repository = gcp.securesourcemanager.Repository("repository",
    repository_id="my-basic-repository",
    location=instance.location,
    instance=instance.name)
basic = gcp.securesourcemanager.BranchRule("basic",
    branch_rule_id="my-basic-branchrule",
    repository_id=repository.repository_id,
    location=repository.location,
    include_pattern="main")
package main
import (
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/securesourcemanager"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		instance, err := securesourcemanager.NewInstance(ctx, "instance", &securesourcemanager.InstanceArgs{
			Location:   pulumi.String("us-central1"),
			InstanceId: pulumi.String("my-basic-instance"),
		})
		if err != nil {
			return err
		}
		repository, err := securesourcemanager.NewRepository(ctx, "repository", &securesourcemanager.RepositoryArgs{
			RepositoryId: pulumi.String("my-basic-repository"),
			Location:     instance.Location,
			Instance:     instance.Name,
		})
		if err != nil {
			return err
		}
		_, err = securesourcemanager.NewBranchRule(ctx, "basic", &securesourcemanager.BranchRuleArgs{
			BranchRuleId:   pulumi.String("my-basic-branchrule"),
			RepositoryId:   repository.RepositoryId,
			Location:       repository.Location,
			IncludePattern: pulumi.String("main"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() => 
{
    var instance = new Gcp.SecureSourceManager.Instance("instance", new()
    {
        Location = "us-central1",
        InstanceId = "my-basic-instance",
    });
    var repository = new Gcp.SecureSourceManager.Repository("repository", new()
    {
        RepositoryId = "my-basic-repository",
        Location = instance.Location,
        Instance = instance.Name,
    });
    var basic = new Gcp.SecureSourceManager.BranchRule("basic", new()
    {
        BranchRuleId = "my-basic-branchrule",
        RepositoryId = repository.RepositoryId,
        Location = repository.Location,
        IncludePattern = "main",
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.securesourcemanager.Instance;
import com.pulumi.gcp.securesourcemanager.InstanceArgs;
import com.pulumi.gcp.securesourcemanager.Repository;
import com.pulumi.gcp.securesourcemanager.RepositoryArgs;
import com.pulumi.gcp.securesourcemanager.BranchRule;
import com.pulumi.gcp.securesourcemanager.BranchRuleArgs;
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) {
        var instance = new Instance("instance", InstanceArgs.builder()
            .location("us-central1")
            .instanceId("my-basic-instance")
            .build());
        var repository = new Repository("repository", RepositoryArgs.builder()
            .repositoryId("my-basic-repository")
            .location(instance.location())
            .instance(instance.name())
            .build());
        var basic = new BranchRule("basic", BranchRuleArgs.builder()
            .branchRuleId("my-basic-branchrule")
            .repositoryId(repository.repositoryId())
            .location(repository.location())
            .includePattern("main")
            .build());
    }
}
resources:
  instance:
    type: gcp:securesourcemanager:Instance
    properties:
      location: us-central1
      instanceId: my-basic-instance
  repository:
    type: gcp:securesourcemanager:Repository
    properties:
      repositoryId: my-basic-repository
      location: ${instance.location}
      instance: ${instance.name}
  basic:
    type: gcp:securesourcemanager:BranchRule
    properties:
      branchRuleId: my-basic-branchrule
      repositoryId: ${repository.repositoryId}
      location: ${repository.location}
      includePattern: main
Secure Source Manager Branch Rule With Fields
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const instance = new gcp.securesourcemanager.Instance("instance", {
    location: "us-central1",
    instanceId: "my-initial-instance",
});
const repository = new gcp.securesourcemanager.Repository("repository", {
    repositoryId: "my-initial-repository",
    instance: instance.name,
    location: instance.location,
});
const _default = new gcp.securesourcemanager.BranchRule("default", {
    branchRuleId: "my-initial-branchrule",
    location: repository.location,
    repositoryId: repository.repositoryId,
    includePattern: "test",
    minimumApprovalsCount: 2,
    minimumReviewsCount: 2,
    requireCommentsResolved: true,
    requireLinearHistory: true,
    requirePullRequest: true,
    disabled: false,
    allowStaleReviews: false,
});
import pulumi
import pulumi_gcp as gcp
instance = gcp.securesourcemanager.Instance("instance",
    location="us-central1",
    instance_id="my-initial-instance")
repository = gcp.securesourcemanager.Repository("repository",
    repository_id="my-initial-repository",
    instance=instance.name,
    location=instance.location)
default = gcp.securesourcemanager.BranchRule("default",
    branch_rule_id="my-initial-branchrule",
    location=repository.location,
    repository_id=repository.repository_id,
    include_pattern="test",
    minimum_approvals_count=2,
    minimum_reviews_count=2,
    require_comments_resolved=True,
    require_linear_history=True,
    require_pull_request=True,
    disabled=False,
    allow_stale_reviews=False)
package main
import (
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/securesourcemanager"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		instance, err := securesourcemanager.NewInstance(ctx, "instance", &securesourcemanager.InstanceArgs{
			Location:   pulumi.String("us-central1"),
			InstanceId: pulumi.String("my-initial-instance"),
		})
		if err != nil {
			return err
		}
		repository, err := securesourcemanager.NewRepository(ctx, "repository", &securesourcemanager.RepositoryArgs{
			RepositoryId: pulumi.String("my-initial-repository"),
			Instance:     instance.Name,
			Location:     instance.Location,
		})
		if err != nil {
			return err
		}
		_, err = securesourcemanager.NewBranchRule(ctx, "default", &securesourcemanager.BranchRuleArgs{
			BranchRuleId:            pulumi.String("my-initial-branchrule"),
			Location:                repository.Location,
			RepositoryId:            repository.RepositoryId,
			IncludePattern:          pulumi.String("test"),
			MinimumApprovalsCount:   pulumi.Int(2),
			MinimumReviewsCount:     pulumi.Int(2),
			RequireCommentsResolved: pulumi.Bool(true),
			RequireLinearHistory:    pulumi.Bool(true),
			RequirePullRequest:      pulumi.Bool(true),
			Disabled:                pulumi.Bool(false),
			AllowStaleReviews:       pulumi.Bool(false),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() => 
{
    var instance = new Gcp.SecureSourceManager.Instance("instance", new()
    {
        Location = "us-central1",
        InstanceId = "my-initial-instance",
    });
    var repository = new Gcp.SecureSourceManager.Repository("repository", new()
    {
        RepositoryId = "my-initial-repository",
        Instance = instance.Name,
        Location = instance.Location,
    });
    var @default = new Gcp.SecureSourceManager.BranchRule("default", new()
    {
        BranchRuleId = "my-initial-branchrule",
        Location = repository.Location,
        RepositoryId = repository.RepositoryId,
        IncludePattern = "test",
        MinimumApprovalsCount = 2,
        MinimumReviewsCount = 2,
        RequireCommentsResolved = true,
        RequireLinearHistory = true,
        RequirePullRequest = true,
        Disabled = false,
        AllowStaleReviews = false,
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.securesourcemanager.Instance;
import com.pulumi.gcp.securesourcemanager.InstanceArgs;
import com.pulumi.gcp.securesourcemanager.Repository;
import com.pulumi.gcp.securesourcemanager.RepositoryArgs;
import com.pulumi.gcp.securesourcemanager.BranchRule;
import com.pulumi.gcp.securesourcemanager.BranchRuleArgs;
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) {
        var instance = new Instance("instance", InstanceArgs.builder()
            .location("us-central1")
            .instanceId("my-initial-instance")
            .build());
        var repository = new Repository("repository", RepositoryArgs.builder()
            .repositoryId("my-initial-repository")
            .instance(instance.name())
            .location(instance.location())
            .build());
        var default_ = new BranchRule("default", BranchRuleArgs.builder()
            .branchRuleId("my-initial-branchrule")
            .location(repository.location())
            .repositoryId(repository.repositoryId())
            .includePattern("test")
            .minimumApprovalsCount(2)
            .minimumReviewsCount(2)
            .requireCommentsResolved(true)
            .requireLinearHistory(true)
            .requirePullRequest(true)
            .disabled(false)
            .allowStaleReviews(false)
            .build());
    }
}
resources:
  instance:
    type: gcp:securesourcemanager:Instance
    properties:
      location: us-central1
      instanceId: my-initial-instance
  repository:
    type: gcp:securesourcemanager:Repository
    properties:
      repositoryId: my-initial-repository
      instance: ${instance.name}
      location: ${instance.location}
  default:
    type: gcp:securesourcemanager:BranchRule
    properties:
      branchRuleId: my-initial-branchrule
      location: ${repository.location}
      repositoryId: ${repository.repositoryId}
      includePattern: test
      minimumApprovalsCount: 2
      minimumReviewsCount: 2
      requireCommentsResolved: true
      requireLinearHistory: true
      requirePullRequest: true
      disabled: false
      allowStaleReviews: false
Create BranchRule Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new BranchRule(name: string, args: BranchRuleArgs, opts?: CustomResourceOptions);@overload
def BranchRule(resource_name: str,
               args: BranchRuleArgs,
               opts: Optional[ResourceOptions] = None)
@overload
def BranchRule(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               branch_rule_id: Optional[str] = None,
               include_pattern: Optional[str] = None,
               location: Optional[str] = None,
               repository_id: Optional[str] = None,
               allow_stale_reviews: Optional[bool] = None,
               disabled: Optional[bool] = None,
               minimum_approvals_count: Optional[int] = None,
               minimum_reviews_count: Optional[int] = None,
               project: Optional[str] = None,
               require_comments_resolved: Optional[bool] = None,
               require_linear_history: Optional[bool] = None,
               require_pull_request: Optional[bool] = None)func NewBranchRule(ctx *Context, name string, args BranchRuleArgs, opts ...ResourceOption) (*BranchRule, error)public BranchRule(string name, BranchRuleArgs args, CustomResourceOptions? opts = null)
public BranchRule(String name, BranchRuleArgs args)
public BranchRule(String name, BranchRuleArgs args, CustomResourceOptions options)
type: gcp:securesourcemanager:BranchRule
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args BranchRuleArgs
- 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 BranchRuleArgs
- 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 BranchRuleArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args BranchRuleArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args BranchRuleArgs
- 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 branchRuleResource = new Gcp.SecureSourceManager.BranchRule("branchRuleResource", new()
{
    BranchRuleId = "string",
    IncludePattern = "string",
    Location = "string",
    RepositoryId = "string",
    AllowStaleReviews = false,
    Disabled = false,
    MinimumApprovalsCount = 0,
    MinimumReviewsCount = 0,
    Project = "string",
    RequireCommentsResolved = false,
    RequireLinearHistory = false,
    RequirePullRequest = false,
});
example, err := securesourcemanager.NewBranchRule(ctx, "branchRuleResource", &securesourcemanager.BranchRuleArgs{
	BranchRuleId:            pulumi.String("string"),
	IncludePattern:          pulumi.String("string"),
	Location:                pulumi.String("string"),
	RepositoryId:            pulumi.String("string"),
	AllowStaleReviews:       pulumi.Bool(false),
	Disabled:                pulumi.Bool(false),
	MinimumApprovalsCount:   pulumi.Int(0),
	MinimumReviewsCount:     pulumi.Int(0),
	Project:                 pulumi.String("string"),
	RequireCommentsResolved: pulumi.Bool(false),
	RequireLinearHistory:    pulumi.Bool(false),
	RequirePullRequest:      pulumi.Bool(false),
})
var branchRuleResource = new BranchRule("branchRuleResource", BranchRuleArgs.builder()
    .branchRuleId("string")
    .includePattern("string")
    .location("string")
    .repositoryId("string")
    .allowStaleReviews(false)
    .disabled(false)
    .minimumApprovalsCount(0)
    .minimumReviewsCount(0)
    .project("string")
    .requireCommentsResolved(false)
    .requireLinearHistory(false)
    .requirePullRequest(false)
    .build());
branch_rule_resource = gcp.securesourcemanager.BranchRule("branchRuleResource",
    branch_rule_id="string",
    include_pattern="string",
    location="string",
    repository_id="string",
    allow_stale_reviews=False,
    disabled=False,
    minimum_approvals_count=0,
    minimum_reviews_count=0,
    project="string",
    require_comments_resolved=False,
    require_linear_history=False,
    require_pull_request=False)
const branchRuleResource = new gcp.securesourcemanager.BranchRule("branchRuleResource", {
    branchRuleId: "string",
    includePattern: "string",
    location: "string",
    repositoryId: "string",
    allowStaleReviews: false,
    disabled: false,
    minimumApprovalsCount: 0,
    minimumReviewsCount: 0,
    project: "string",
    requireCommentsResolved: false,
    requireLinearHistory: false,
    requirePullRequest: false,
});
type: gcp:securesourcemanager:BranchRule
properties:
    allowStaleReviews: false
    branchRuleId: string
    disabled: false
    includePattern: string
    location: string
    minimumApprovalsCount: 0
    minimumReviewsCount: 0
    project: string
    repositoryId: string
    requireCommentsResolved: false
    requireLinearHistory: false
    requirePullRequest: false
BranchRule 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 BranchRule resource accepts the following input properties:
- BranchRule stringId 
- The ID for the BranchRule.
- IncludePattern string
- The BranchRule matches branches based on the specified regular expression. Use .* to match all branches.
- Location string
- The location for the Repository.
- RepositoryId string
- The ID for the Repository.
- AllowStale boolReviews 
- Determines if allow stale reviews or approvals before merging to the branch.
- Disabled bool
- Determines if the branch rule is disabled or not.
- MinimumApprovals intCount 
- The minimum number of approvals required for the branch rule to be matched.
- MinimumReviews intCount 
- The minimum number of reviews required for the branch rule to be matched.
- Project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- RequireComments boolResolved 
- Determines if require comments resolved before merging to the branch.
- RequireLinear boolHistory 
- Determines if require linear history before merging to the branch.
- RequirePull boolRequest 
- Determines if the branch rule requires a pull request or not.
- BranchRule stringId 
- The ID for the BranchRule.
- IncludePattern string
- The BranchRule matches branches based on the specified regular expression. Use .* to match all branches.
- Location string
- The location for the Repository.
- RepositoryId string
- The ID for the Repository.
- AllowStale boolReviews 
- Determines if allow stale reviews or approvals before merging to the branch.
- Disabled bool
- Determines if the branch rule is disabled or not.
- MinimumApprovals intCount 
- The minimum number of approvals required for the branch rule to be matched.
- MinimumReviews intCount 
- The minimum number of reviews required for the branch rule to be matched.
- Project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- RequireComments boolResolved 
- Determines if require comments resolved before merging to the branch.
- RequireLinear boolHistory 
- Determines if require linear history before merging to the branch.
- RequirePull boolRequest 
- Determines if the branch rule requires a pull request or not.
- branchRule StringId 
- The ID for the BranchRule.
- includePattern String
- The BranchRule matches branches based on the specified regular expression. Use .* to match all branches.
- location String
- The location for the Repository.
- repositoryId String
- The ID for the Repository.
- allowStale BooleanReviews 
- Determines if allow stale reviews or approvals before merging to the branch.
- disabled Boolean
- Determines if the branch rule is disabled or not.
- minimumApprovals IntegerCount 
- The minimum number of approvals required for the branch rule to be matched.
- minimumReviews IntegerCount 
- The minimum number of reviews required for the branch rule to be matched.
- project String
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- requireComments BooleanResolved 
- Determines if require comments resolved before merging to the branch.
- requireLinear BooleanHistory 
- Determines if require linear history before merging to the branch.
- requirePull BooleanRequest 
- Determines if the branch rule requires a pull request or not.
- branchRule stringId 
- The ID for the BranchRule.
- includePattern string
- The BranchRule matches branches based on the specified regular expression. Use .* to match all branches.
- location string
- The location for the Repository.
- repositoryId string
- The ID for the Repository.
- allowStale booleanReviews 
- Determines if allow stale reviews or approvals before merging to the branch.
- disabled boolean
- Determines if the branch rule is disabled or not.
- minimumApprovals numberCount 
- The minimum number of approvals required for the branch rule to be matched.
- minimumReviews numberCount 
- The minimum number of reviews required for the branch rule to be matched.
- project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- requireComments booleanResolved 
- Determines if require comments resolved before merging to the branch.
- requireLinear booleanHistory 
- Determines if require linear history before merging to the branch.
- requirePull booleanRequest 
- Determines if the branch rule requires a pull request or not.
- branch_rule_ strid 
- The ID for the BranchRule.
- include_pattern str
- The BranchRule matches branches based on the specified regular expression. Use .* to match all branches.
- location str
- The location for the Repository.
- repository_id str
- The ID for the Repository.
- allow_stale_ boolreviews 
- Determines if allow stale reviews or approvals before merging to the branch.
- disabled bool
- Determines if the branch rule is disabled or not.
- minimum_approvals_ intcount 
- The minimum number of approvals required for the branch rule to be matched.
- minimum_reviews_ intcount 
- The minimum number of reviews required for the branch rule to be matched.
- project str
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- require_comments_ boolresolved 
- Determines if require comments resolved before merging to the branch.
- require_linear_ boolhistory 
- Determines if require linear history before merging to the branch.
- require_pull_ boolrequest 
- Determines if the branch rule requires a pull request or not.
- branchRule StringId 
- The ID for the BranchRule.
- includePattern String
- The BranchRule matches branches based on the specified regular expression. Use .* to match all branches.
- location String
- The location for the Repository.
- repositoryId String
- The ID for the Repository.
- allowStale BooleanReviews 
- Determines if allow stale reviews or approvals before merging to the branch.
- disabled Boolean
- Determines if the branch rule is disabled or not.
- minimumApprovals NumberCount 
- The minimum number of approvals required for the branch rule to be matched.
- minimumReviews NumberCount 
- The minimum number of reviews required for the branch rule to be matched.
- project String
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- requireComments BooleanResolved 
- Determines if require comments resolved before merging to the branch.
- requireLinear BooleanHistory 
- Determines if require linear history before merging to the branch.
- requirePull BooleanRequest 
- Determines if the branch rule requires a pull request or not.
Outputs
All input properties are implicitly available as output properties. Additionally, the BranchRule resource produces the following output properties:
- CreateTime string
- Time the BranchRule was created in UTC.
- Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- The resource name for the BranchRule.
- Uid string
- Unique identifier of the BranchRule.
- UpdateTime string
- Time the BranchRule was updated in UTC.
- CreateTime string
- Time the BranchRule was created in UTC.
- Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- The resource name for the BranchRule.
- Uid string
- Unique identifier of the BranchRule.
- UpdateTime string
- Time the BranchRule was updated in UTC.
- createTime String
- Time the BranchRule was created in UTC.
- id String
- The provider-assigned unique ID for this managed resource.
- name String
- The resource name for the BranchRule.
- uid String
- Unique identifier of the BranchRule.
- updateTime String
- Time the BranchRule was updated in UTC.
- createTime string
- Time the BranchRule was created in UTC.
- id string
- The provider-assigned unique ID for this managed resource.
- name string
- The resource name for the BranchRule.
- uid string
- Unique identifier of the BranchRule.
- updateTime string
- Time the BranchRule was updated in UTC.
- create_time str
- Time the BranchRule was created in UTC.
- id str
- The provider-assigned unique ID for this managed resource.
- name str
- The resource name for the BranchRule.
- uid str
- Unique identifier of the BranchRule.
- update_time str
- Time the BranchRule was updated in UTC.
- createTime String
- Time the BranchRule was created in UTC.
- id String
- The provider-assigned unique ID for this managed resource.
- name String
- The resource name for the BranchRule.
- uid String
- Unique identifier of the BranchRule.
- updateTime String
- Time the BranchRule was updated in UTC.
Look up Existing BranchRule Resource
Get an existing BranchRule 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?: BranchRuleState, opts?: CustomResourceOptions): BranchRule@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        allow_stale_reviews: Optional[bool] = None,
        branch_rule_id: Optional[str] = None,
        create_time: Optional[str] = None,
        disabled: Optional[bool] = None,
        include_pattern: Optional[str] = None,
        location: Optional[str] = None,
        minimum_approvals_count: Optional[int] = None,
        minimum_reviews_count: Optional[int] = None,
        name: Optional[str] = None,
        project: Optional[str] = None,
        repository_id: Optional[str] = None,
        require_comments_resolved: Optional[bool] = None,
        require_linear_history: Optional[bool] = None,
        require_pull_request: Optional[bool] = None,
        uid: Optional[str] = None,
        update_time: Optional[str] = None) -> BranchRulefunc GetBranchRule(ctx *Context, name string, id IDInput, state *BranchRuleState, opts ...ResourceOption) (*BranchRule, error)public static BranchRule Get(string name, Input<string> id, BranchRuleState? state, CustomResourceOptions? opts = null)public static BranchRule get(String name, Output<String> id, BranchRuleState state, CustomResourceOptions options)resources:  _:    type: gcp:securesourcemanager:BranchRule    get:      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.
- AllowStale boolReviews 
- Determines if allow stale reviews or approvals before merging to the branch.
- BranchRule stringId 
- The ID for the BranchRule.
- CreateTime string
- Time the BranchRule was created in UTC.
- Disabled bool
- Determines if the branch rule is disabled or not.
- IncludePattern string
- The BranchRule matches branches based on the specified regular expression. Use .* to match all branches.
- Location string
- The location for the Repository.
- MinimumApprovals intCount 
- The minimum number of approvals required for the branch rule to be matched.
- MinimumReviews intCount 
- The minimum number of reviews required for the branch rule to be matched.
- Name string
- The resource name for the BranchRule.
- Project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- RepositoryId string
- The ID for the Repository.
- RequireComments boolResolved 
- Determines if require comments resolved before merging to the branch.
- RequireLinear boolHistory 
- Determines if require linear history before merging to the branch.
- RequirePull boolRequest 
- Determines if the branch rule requires a pull request or not.
- Uid string
- Unique identifier of the BranchRule.
- UpdateTime string
- Time the BranchRule was updated in UTC.
- AllowStale boolReviews 
- Determines if allow stale reviews or approvals before merging to the branch.
- BranchRule stringId 
- The ID for the BranchRule.
- CreateTime string
- Time the BranchRule was created in UTC.
- Disabled bool
- Determines if the branch rule is disabled or not.
- IncludePattern string
- The BranchRule matches branches based on the specified regular expression. Use .* to match all branches.
- Location string
- The location for the Repository.
- MinimumApprovals intCount 
- The minimum number of approvals required for the branch rule to be matched.
- MinimumReviews intCount 
- The minimum number of reviews required for the branch rule to be matched.
- Name string
- The resource name for the BranchRule.
- Project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- RepositoryId string
- The ID for the Repository.
- RequireComments boolResolved 
- Determines if require comments resolved before merging to the branch.
- RequireLinear boolHistory 
- Determines if require linear history before merging to the branch.
- RequirePull boolRequest 
- Determines if the branch rule requires a pull request or not.
- Uid string
- Unique identifier of the BranchRule.
- UpdateTime string
- Time the BranchRule was updated in UTC.
- allowStale BooleanReviews 
- Determines if allow stale reviews or approvals before merging to the branch.
- branchRule StringId 
- The ID for the BranchRule.
- createTime String
- Time the BranchRule was created in UTC.
- disabled Boolean
- Determines if the branch rule is disabled or not.
- includePattern String
- The BranchRule matches branches based on the specified regular expression. Use .* to match all branches.
- location String
- The location for the Repository.
- minimumApprovals IntegerCount 
- The minimum number of approvals required for the branch rule to be matched.
- minimumReviews IntegerCount 
- The minimum number of reviews required for the branch rule to be matched.
- name String
- The resource name for the BranchRule.
- project String
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- repositoryId String
- The ID for the Repository.
- requireComments BooleanResolved 
- Determines if require comments resolved before merging to the branch.
- requireLinear BooleanHistory 
- Determines if require linear history before merging to the branch.
- requirePull BooleanRequest 
- Determines if the branch rule requires a pull request or not.
- uid String
- Unique identifier of the BranchRule.
- updateTime String
- Time the BranchRule was updated in UTC.
- allowStale booleanReviews 
- Determines if allow stale reviews or approvals before merging to the branch.
- branchRule stringId 
- The ID for the BranchRule.
- createTime string
- Time the BranchRule was created in UTC.
- disabled boolean
- Determines if the branch rule is disabled or not.
- includePattern string
- The BranchRule matches branches based on the specified regular expression. Use .* to match all branches.
- location string
- The location for the Repository.
- minimumApprovals numberCount 
- The minimum number of approvals required for the branch rule to be matched.
- minimumReviews numberCount 
- The minimum number of reviews required for the branch rule to be matched.
- name string
- The resource name for the BranchRule.
- project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- repositoryId string
- The ID for the Repository.
- requireComments booleanResolved 
- Determines if require comments resolved before merging to the branch.
- requireLinear booleanHistory 
- Determines if require linear history before merging to the branch.
- requirePull booleanRequest 
- Determines if the branch rule requires a pull request or not.
- uid string
- Unique identifier of the BranchRule.
- updateTime string
- Time the BranchRule was updated in UTC.
- allow_stale_ boolreviews 
- Determines if allow stale reviews or approvals before merging to the branch.
- branch_rule_ strid 
- The ID for the BranchRule.
- create_time str
- Time the BranchRule was created in UTC.
- disabled bool
- Determines if the branch rule is disabled or not.
- include_pattern str
- The BranchRule matches branches based on the specified regular expression. Use .* to match all branches.
- location str
- The location for the Repository.
- minimum_approvals_ intcount 
- The minimum number of approvals required for the branch rule to be matched.
- minimum_reviews_ intcount 
- The minimum number of reviews required for the branch rule to be matched.
- name str
- The resource name for the BranchRule.
- project str
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- repository_id str
- The ID for the Repository.
- require_comments_ boolresolved 
- Determines if require comments resolved before merging to the branch.
- require_linear_ boolhistory 
- Determines if require linear history before merging to the branch.
- require_pull_ boolrequest 
- Determines if the branch rule requires a pull request or not.
- uid str
- Unique identifier of the BranchRule.
- update_time str
- Time the BranchRule was updated in UTC.
- allowStale BooleanReviews 
- Determines if allow stale reviews or approvals before merging to the branch.
- branchRule StringId 
- The ID for the BranchRule.
- createTime String
- Time the BranchRule was created in UTC.
- disabled Boolean
- Determines if the branch rule is disabled or not.
- includePattern String
- The BranchRule matches branches based on the specified regular expression. Use .* to match all branches.
- location String
- The location for the Repository.
- minimumApprovals NumberCount 
- The minimum number of approvals required for the branch rule to be matched.
- minimumReviews NumberCount 
- The minimum number of reviews required for the branch rule to be matched.
- name String
- The resource name for the BranchRule.
- project String
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- repositoryId String
- The ID for the Repository.
- requireComments BooleanResolved 
- Determines if require comments resolved before merging to the branch.
- requireLinear BooleanHistory 
- Determines if require linear history before merging to the branch.
- requirePull BooleanRequest 
- Determines if the branch rule requires a pull request or not.
- uid String
- Unique identifier of the BranchRule.
- updateTime String
- Time the BranchRule was updated in UTC.
Import
BranchRule can be imported using any of these accepted formats:
- projects/{{project}}/locations/{{location}}/repositories/{{repository_id}}/branchRules/{{branch_rule_id}}
- {{project}}/{{location}}/{{repository_id}}/{{branch_rule_id}}
- {{location}}/{{repository_id}}/{{branch_rule_id}}
- {{branch_rule_id}}
When using the pulumi import command, BranchRule can be imported using one of the formats above. For example:
$ pulumi import gcp:securesourcemanager/branchRule:BranchRule default projects/{{project}}/locations/{{location}}/repositories/{{repository_id}}/branchRules/{{branch_rule_id}}
$ pulumi import gcp:securesourcemanager/branchRule:BranchRule default {{project}}/{{location}}/{{repository_id}}/{{branch_rule_id}}
$ pulumi import gcp:securesourcemanager/branchRule:BranchRule default {{location}}/{{repository_id}}/{{branch_rule_id}}
$ pulumi import gcp:securesourcemanager/branchRule:BranchRule default {{branch_rule_id}}
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Google Cloud (GCP) Classic pulumi/pulumi-gcp
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the google-betaTerraform Provider.