github.RepositoryDeploymentBranchPolicy
Explore with Pulumi AI
This resource allows you to create and manage deployment branch policies.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as github from "@pulumi/github";
const env = new github.RepositoryEnvironment("env", {
repository: "my_repo",
environment: "my_env",
deploymentBranchPolicy: {
protectedBranches: false,
customBranchPolicies: true,
},
});
const foo = new github.RepositoryDeploymentBranchPolicy("foo", {
repository: "my_repo",
environmentName: "my_env",
name: "foo",
}, {
dependsOn: [env],
});
import pulumi
import pulumi_github as github
env = github.RepositoryEnvironment("env",
repository="my_repo",
environment="my_env",
deployment_branch_policy={
"protected_branches": False,
"custom_branch_policies": True,
})
foo = github.RepositoryDeploymentBranchPolicy("foo",
repository="my_repo",
environment_name="my_env",
name="foo",
opts = pulumi.ResourceOptions(depends_on=[env]))
package main
import (
"github.com/pulumi/pulumi-github/sdk/v6/go/github"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
env, err := github.NewRepositoryEnvironment(ctx, "env", &github.RepositoryEnvironmentArgs{
Repository: pulumi.String("my_repo"),
Environment: pulumi.String("my_env"),
DeploymentBranchPolicy: &github.RepositoryEnvironmentDeploymentBranchPolicyArgs{
ProtectedBranches: pulumi.Bool(false),
CustomBranchPolicies: pulumi.Bool(true),
},
})
if err != nil {
return err
}
_, err = github.NewRepositoryDeploymentBranchPolicy(ctx, "foo", &github.RepositoryDeploymentBranchPolicyArgs{
Repository: pulumi.String("my_repo"),
EnvironmentName: pulumi.String("my_env"),
Name: pulumi.String("foo"),
}, pulumi.DependsOn([]pulumi.Resource{
env,
}))
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Github = Pulumi.Github;
return await Deployment.RunAsync(() =>
{
var env = new Github.RepositoryEnvironment("env", new()
{
Repository = "my_repo",
Environment = "my_env",
DeploymentBranchPolicy = new Github.Inputs.RepositoryEnvironmentDeploymentBranchPolicyArgs
{
ProtectedBranches = false,
CustomBranchPolicies = true,
},
});
var foo = new Github.RepositoryDeploymentBranchPolicy("foo", new()
{
Repository = "my_repo",
EnvironmentName = "my_env",
Name = "foo",
}, new CustomResourceOptions
{
DependsOn =
{
env,
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.github.RepositoryEnvironment;
import com.pulumi.github.RepositoryEnvironmentArgs;
import com.pulumi.github.inputs.RepositoryEnvironmentDeploymentBranchPolicyArgs;
import com.pulumi.github.RepositoryDeploymentBranchPolicy;
import com.pulumi.github.RepositoryDeploymentBranchPolicyArgs;
import com.pulumi.resources.CustomResourceOptions;
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 env = new RepositoryEnvironment("env", RepositoryEnvironmentArgs.builder()
.repository("my_repo")
.environment("my_env")
.deploymentBranchPolicy(RepositoryEnvironmentDeploymentBranchPolicyArgs.builder()
.protectedBranches(false)
.customBranchPolicies(true)
.build())
.build());
var foo = new RepositoryDeploymentBranchPolicy("foo", RepositoryDeploymentBranchPolicyArgs.builder()
.repository("my_repo")
.environmentName("my_env")
.name("foo")
.build(), CustomResourceOptions.builder()
.dependsOn(env)
.build());
}
}
resources:
env:
type: github:RepositoryEnvironment
properties:
repository: my_repo
environment: my_env
deploymentBranchPolicy:
protectedBranches: false
customBranchPolicies: true
foo:
type: github:RepositoryDeploymentBranchPolicy
properties:
repository: my_repo
environmentName: my_env
name: foo
options:
dependsOn:
- ${env}
Create RepositoryDeploymentBranchPolicy Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new RepositoryDeploymentBranchPolicy(name: string, args: RepositoryDeploymentBranchPolicyArgs, opts?: CustomResourceOptions);
@overload
def RepositoryDeploymentBranchPolicy(resource_name: str,
args: RepositoryDeploymentBranchPolicyArgs,
opts: Optional[ResourceOptions] = None)
@overload
def RepositoryDeploymentBranchPolicy(resource_name: str,
opts: Optional[ResourceOptions] = None,
environment_name: Optional[str] = None,
repository: Optional[str] = None,
name: Optional[str] = None)
func NewRepositoryDeploymentBranchPolicy(ctx *Context, name string, args RepositoryDeploymentBranchPolicyArgs, opts ...ResourceOption) (*RepositoryDeploymentBranchPolicy, error)
public RepositoryDeploymentBranchPolicy(string name, RepositoryDeploymentBranchPolicyArgs args, CustomResourceOptions? opts = null)
public RepositoryDeploymentBranchPolicy(String name, RepositoryDeploymentBranchPolicyArgs args)
public RepositoryDeploymentBranchPolicy(String name, RepositoryDeploymentBranchPolicyArgs args, CustomResourceOptions options)
type: github:RepositoryDeploymentBranchPolicy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name
This property is required. string - The unique name of the resource.
- args
This property is required. RepositoryDeploymentBranchPolicyArgs - The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name
This property is required. str - The unique name of the resource.
- args
This property is required. RepositoryDeploymentBranchPolicyArgs - The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name
This property is required. string - The unique name of the resource.
- args
This property is required. RepositoryDeploymentBranchPolicyArgs - The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name
This property is required. string - The unique name of the resource.
- args
This property is required. RepositoryDeploymentBranchPolicyArgs - The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name
This property is required. String - The unique name of the resource.
- args
This property is required. RepositoryDeploymentBranchPolicyArgs - 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 repositoryDeploymentBranchPolicyResource = new Github.RepositoryDeploymentBranchPolicy("repositoryDeploymentBranchPolicyResource", new()
{
EnvironmentName = "string",
Repository = "string",
Name = "string",
});
example, err := github.NewRepositoryDeploymentBranchPolicy(ctx, "repositoryDeploymentBranchPolicyResource", &github.RepositoryDeploymentBranchPolicyArgs{
EnvironmentName: pulumi.String("string"),
Repository: pulumi.String("string"),
Name: pulumi.String("string"),
})
var repositoryDeploymentBranchPolicyResource = new RepositoryDeploymentBranchPolicy("repositoryDeploymentBranchPolicyResource", RepositoryDeploymentBranchPolicyArgs.builder()
.environmentName("string")
.repository("string")
.name("string")
.build());
repository_deployment_branch_policy_resource = github.RepositoryDeploymentBranchPolicy("repositoryDeploymentBranchPolicyResource",
environment_name="string",
repository="string",
name="string")
const repositoryDeploymentBranchPolicyResource = new github.RepositoryDeploymentBranchPolicy("repositoryDeploymentBranchPolicyResource", {
environmentName: "string",
repository: "string",
name: "string",
});
type: github:RepositoryDeploymentBranchPolicy
properties:
environmentName: string
name: string
repository: string
RepositoryDeploymentBranchPolicy 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 RepositoryDeploymentBranchPolicy resource accepts the following input properties:
- Environment
Name This property is required. Changes to this property will trigger replacement.
- The name of the environment. This environment must have
deployment_branch_policy.custom_branch_policies
set to true or a 404 error will be thrown. - Repository
This property is required. Changes to this property will trigger replacement.
- The repository to create the policy in.
- Name string
- The name pattern that branches must match in order to deploy to the environment.
- Environment
Name This property is required. Changes to this property will trigger replacement.
- The name of the environment. This environment must have
deployment_branch_policy.custom_branch_policies
set to true or a 404 error will be thrown. - Repository
This property is required. Changes to this property will trigger replacement.
- The repository to create the policy in.
- Name string
- The name pattern that branches must match in order to deploy to the environment.
- environment
Name This property is required. Changes to this property will trigger replacement.
- The name of the environment. This environment must have
deployment_branch_policy.custom_branch_policies
set to true or a 404 error will be thrown. - repository
This property is required. Changes to this property will trigger replacement.
- The repository to create the policy in.
- name String
- The name pattern that branches must match in order to deploy to the environment.
- environment
Name This property is required. Changes to this property will trigger replacement.
- The name of the environment. This environment must have
deployment_branch_policy.custom_branch_policies
set to true or a 404 error will be thrown. - repository
This property is required. Changes to this property will trigger replacement.
- The repository to create the policy in.
- name string
- The name pattern that branches must match in order to deploy to the environment.
- environment_
name This property is required. Changes to this property will trigger replacement.
- The name of the environment. This environment must have
deployment_branch_policy.custom_branch_policies
set to true or a 404 error will be thrown. - repository
This property is required. Changes to this property will trigger replacement.
- The repository to create the policy in.
- name str
- The name pattern that branches must match in order to deploy to the environment.
- environment
Name This property is required. Changes to this property will trigger replacement.
- The name of the environment. This environment must have
deployment_branch_policy.custom_branch_policies
set to true or a 404 error will be thrown. - repository
This property is required. Changes to this property will trigger replacement.
- The repository to create the policy in.
- name String
- The name pattern that branches must match in order to deploy to the environment.
Outputs
All input properties are implicitly available as output properties. Additionally, the RepositoryDeploymentBranchPolicy resource produces the following output properties:
Look up Existing RepositoryDeploymentBranchPolicy Resource
Get an existing RepositoryDeploymentBranchPolicy 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?: RepositoryDeploymentBranchPolicyState, opts?: CustomResourceOptions): RepositoryDeploymentBranchPolicy
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
environment_name: Optional[str] = None,
etag: Optional[str] = None,
name: Optional[str] = None,
repository: Optional[str] = None) -> RepositoryDeploymentBranchPolicy
func GetRepositoryDeploymentBranchPolicy(ctx *Context, name string, id IDInput, state *RepositoryDeploymentBranchPolicyState, opts ...ResourceOption) (*RepositoryDeploymentBranchPolicy, error)
public static RepositoryDeploymentBranchPolicy Get(string name, Input<string> id, RepositoryDeploymentBranchPolicyState? state, CustomResourceOptions? opts = null)
public static RepositoryDeploymentBranchPolicy get(String name, Output<String> id, RepositoryDeploymentBranchPolicyState state, CustomResourceOptions options)
resources: _: type: github:RepositoryDeploymentBranchPolicy get: id: ${id}
- name
This property is required. - The unique name of the resulting resource.
- id
This property is required. - 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
This property is required. - The unique name of the resulting resource.
- id
This property is required. - The unique provider ID of the resource to lookup.
- name
This property is required. - The unique name of the resulting resource.
- id
This property is required. - 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
This property is required. - The unique name of the resulting resource.
- id
This property is required. - 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
This property is required. - The unique name of the resulting resource.
- id
This property is required. - 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.
- Environment
Name Changes to this property will trigger replacement.
- The name of the environment. This environment must have
deployment_branch_policy.custom_branch_policies
set to true or a 404 error will be thrown. - Etag string
- An etag representing the Branch object.
- Name string
- The name pattern that branches must match in order to deploy to the environment.
- Repository
Changes to this property will trigger replacement.
- The repository to create the policy in.
- Environment
Name Changes to this property will trigger replacement.
- The name of the environment. This environment must have
deployment_branch_policy.custom_branch_policies
set to true or a 404 error will be thrown. - Etag string
- An etag representing the Branch object.
- Name string
- The name pattern that branches must match in order to deploy to the environment.
- Repository
Changes to this property will trigger replacement.
- The repository to create the policy in.
- environment
Name Changes to this property will trigger replacement.
- The name of the environment. This environment must have
deployment_branch_policy.custom_branch_policies
set to true or a 404 error will be thrown. - etag String
- An etag representing the Branch object.
- name String
- The name pattern that branches must match in order to deploy to the environment.
- repository
Changes to this property will trigger replacement.
- The repository to create the policy in.
- environment
Name Changes to this property will trigger replacement.
- The name of the environment. This environment must have
deployment_branch_policy.custom_branch_policies
set to true or a 404 error will be thrown. - etag string
- An etag representing the Branch object.
- name string
- The name pattern that branches must match in order to deploy to the environment.
- repository
Changes to this property will trigger replacement.
- The repository to create the policy in.
- environment_
name Changes to this property will trigger replacement.
- The name of the environment. This environment must have
deployment_branch_policy.custom_branch_policies
set to true or a 404 error will be thrown. - etag str
- An etag representing the Branch object.
- name str
- The name pattern that branches must match in order to deploy to the environment.
- repository
Changes to this property will trigger replacement.
- The repository to create the policy in.
- environment
Name Changes to this property will trigger replacement.
- The name of the environment. This environment must have
deployment_branch_policy.custom_branch_policies
set to true or a 404 error will be thrown. - etag String
- An etag representing the Branch object.
- name String
- The name pattern that branches must match in order to deploy to the environment.
- repository
Changes to this property will trigger replacement.
- The repository to create the policy in.
Import
$ pulumi import github:index/repositoryDeploymentBranchPolicy:RepositoryDeploymentBranchPolicy foo repo:env:id
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- GitHub pulumi/pulumi-github
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
github
Terraform Provider.