Azure DevOps v2.7.0, Mar 27 23
Azure DevOps v2.7.0, Mar 27 23
azuredevops.CheckBranchControl
Explore with Pulumi AI
Manages a branch control check on a resource within Azure DevOps.
Relevant Links
Example Usage
Protect a service connection
using System.Collections.Generic;
using Pulumi;
using AzureDevOps = Pulumi.AzureDevOps;
return await Deployment.RunAsync(() =>
{
var exampleProject = new AzureDevOps.Project("exampleProject");
var exampleServiceEndpointGeneric = new AzureDevOps.ServiceEndpointGeneric("exampleServiceEndpointGeneric", new()
{
ProjectId = exampleProject.Id,
ServerUrl = "https://some-server.example.com",
Username = "username",
Password = "password",
ServiceEndpointName = "Example Generic",
Description = "Managed by Terraform",
});
var exampleCheckBranchControl = new AzureDevOps.CheckBranchControl("exampleCheckBranchControl", new()
{
ProjectId = exampleProject.Id,
DisplayName = "Managed by Terraform",
TargetResourceId = exampleServiceEndpointGeneric.Id,
TargetResourceType = "endpoint",
AllowedBranches = "refs/heads/main, refs/heads/features/*",
});
});
package main
import (
"github.com/pulumi/pulumi-azuredevops/sdk/v2/go/azuredevops"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleProject, err := azuredevops.NewProject(ctx, "exampleProject", nil)
if err != nil {
return err
}
exampleServiceEndpointGeneric, err := azuredevops.NewServiceEndpointGeneric(ctx, "exampleServiceEndpointGeneric", &azuredevops.ServiceEndpointGenericArgs{
ProjectId: exampleProject.ID(),
ServerUrl: pulumi.String("https://some-server.example.com"),
Username: pulumi.String("username"),
Password: pulumi.String("password"),
ServiceEndpointName: pulumi.String("Example Generic"),
Description: pulumi.String("Managed by Terraform"),
})
if err != nil {
return err
}
_, err = azuredevops.NewCheckBranchControl(ctx, "exampleCheckBranchControl", &azuredevops.CheckBranchControlArgs{
ProjectId: exampleProject.ID(),
DisplayName: pulumi.String("Managed by Terraform"),
TargetResourceId: exampleServiceEndpointGeneric.ID(),
TargetResourceType: pulumi.String("endpoint"),
AllowedBranches: pulumi.String("refs/heads/main, refs/heads/features/*"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azuredevops.Project;
import com.pulumi.azuredevops.ServiceEndpointGeneric;
import com.pulumi.azuredevops.ServiceEndpointGenericArgs;
import com.pulumi.azuredevops.CheckBranchControl;
import com.pulumi.azuredevops.CheckBranchControlArgs;
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 exampleProject = new Project("exampleProject");
var exampleServiceEndpointGeneric = new ServiceEndpointGeneric("exampleServiceEndpointGeneric", ServiceEndpointGenericArgs.builder()
.projectId(exampleProject.id())
.serverUrl("https://some-server.example.com")
.username("username")
.password("password")
.serviceEndpointName("Example Generic")
.description("Managed by Terraform")
.build());
var exampleCheckBranchControl = new CheckBranchControl("exampleCheckBranchControl", CheckBranchControlArgs.builder()
.projectId(exampleProject.id())
.displayName("Managed by Terraform")
.targetResourceId(exampleServiceEndpointGeneric.id())
.targetResourceType("endpoint")
.allowedBranches("refs/heads/main, refs/heads/features/*")
.build());
}
}
import pulumi
import pulumi_azuredevops as azuredevops
example_project = azuredevops.Project("exampleProject")
example_service_endpoint_generic = azuredevops.ServiceEndpointGeneric("exampleServiceEndpointGeneric",
project_id=example_project.id,
server_url="https://some-server.example.com",
username="username",
password="password",
service_endpoint_name="Example Generic",
description="Managed by Terraform")
example_check_branch_control = azuredevops.CheckBranchControl("exampleCheckBranchControl",
project_id=example_project.id,
display_name="Managed by Terraform",
target_resource_id=example_service_endpoint_generic.id,
target_resource_type="endpoint",
allowed_branches="refs/heads/main, refs/heads/features/*")
import * as pulumi from "@pulumi/pulumi";
import * as azuredevops from "@pulumi/azuredevops";
const exampleProject = new azuredevops.Project("exampleProject", {});
const exampleServiceEndpointGeneric = new azuredevops.ServiceEndpointGeneric("exampleServiceEndpointGeneric", {
projectId: exampleProject.id,
serverUrl: "https://some-server.example.com",
username: "username",
password: "password",
serviceEndpointName: "Example Generic",
description: "Managed by Terraform",
});
const exampleCheckBranchControl = new azuredevops.CheckBranchControl("exampleCheckBranchControl", {
projectId: exampleProject.id,
displayName: "Managed by Terraform",
targetResourceId: exampleServiceEndpointGeneric.id,
targetResourceType: "endpoint",
allowedBranches: "refs/heads/main, refs/heads/features/*",
});
resources:
exampleProject:
type: azuredevops:Project
exampleServiceEndpointGeneric:
type: azuredevops:ServiceEndpointGeneric
properties:
projectId: ${exampleProject.id}
serverUrl: https://some-server.example.com
username: username
password: password
serviceEndpointName: Example Generic
description: Managed by Terraform
exampleCheckBranchControl:
type: azuredevops:CheckBranchControl
properties:
projectId: ${exampleProject.id}
displayName: Managed by Terraform
targetResourceId: ${exampleServiceEndpointGeneric.id}
targetResourceType: endpoint
allowedBranches: refs/heads/main, refs/heads/features/*
Protect an environment
using System.Collections.Generic;
using Pulumi;
using AzureDevOps = Pulumi.AzureDevOps;
return await Deployment.RunAsync(() =>
{
var exampleProject = new AzureDevOps.Project("exampleProject");
var exampleEnvironment = new AzureDevOps.Environment("exampleEnvironment", new()
{
ProjectId = exampleProject.Id,
});
var exampleCheckBranchControl = new AzureDevOps.CheckBranchControl("exampleCheckBranchControl", new()
{
ProjectId = exampleProject.Id,
DisplayName = "Managed by Terraform",
TargetResourceId = exampleEnvironment.Id,
TargetResourceType = "environment",
AllowedBranches = "refs/heads/main, refs/heads/features/*",
});
});
package main
import (
"github.com/pulumi/pulumi-azuredevops/sdk/v2/go/azuredevops"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleProject, err := azuredevops.NewProject(ctx, "exampleProject", nil)
if err != nil {
return err
}
exampleEnvironment, err := azuredevops.NewEnvironment(ctx, "exampleEnvironment", &azuredevops.EnvironmentArgs{
ProjectId: exampleProject.ID(),
})
if err != nil {
return err
}
_, err = azuredevops.NewCheckBranchControl(ctx, "exampleCheckBranchControl", &azuredevops.CheckBranchControlArgs{
ProjectId: exampleProject.ID(),
DisplayName: pulumi.String("Managed by Terraform"),
TargetResourceId: exampleEnvironment.ID(),
TargetResourceType: pulumi.String("environment"),
AllowedBranches: pulumi.String("refs/heads/main, refs/heads/features/*"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azuredevops.Project;
import com.pulumi.azuredevops.Environment;
import com.pulumi.azuredevops.EnvironmentArgs;
import com.pulumi.azuredevops.CheckBranchControl;
import com.pulumi.azuredevops.CheckBranchControlArgs;
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 exampleProject = new Project("exampleProject");
var exampleEnvironment = new Environment("exampleEnvironment", EnvironmentArgs.builder()
.projectId(exampleProject.id())
.build());
var exampleCheckBranchControl = new CheckBranchControl("exampleCheckBranchControl", CheckBranchControlArgs.builder()
.projectId(exampleProject.id())
.displayName("Managed by Terraform")
.targetResourceId(exampleEnvironment.id())
.targetResourceType("environment")
.allowedBranches("refs/heads/main, refs/heads/features/*")
.build());
}
}
import pulumi
import pulumi_azuredevops as azuredevops
example_project = azuredevops.Project("exampleProject")
example_environment = azuredevops.Environment("exampleEnvironment", project_id=example_project.id)
example_check_branch_control = azuredevops.CheckBranchControl("exampleCheckBranchControl",
project_id=example_project.id,
display_name="Managed by Terraform",
target_resource_id=example_environment.id,
target_resource_type="environment",
allowed_branches="refs/heads/main, refs/heads/features/*")
import * as pulumi from "@pulumi/pulumi";
import * as azuredevops from "@pulumi/azuredevops";
const exampleProject = new azuredevops.Project("exampleProject", {});
const exampleEnvironment = new azuredevops.Environment("exampleEnvironment", {projectId: exampleProject.id});
const exampleCheckBranchControl = new azuredevops.CheckBranchControl("exampleCheckBranchControl", {
projectId: exampleProject.id,
displayName: "Managed by Terraform",
targetResourceId: exampleEnvironment.id,
targetResourceType: "environment",
allowedBranches: "refs/heads/main, refs/heads/features/*",
});
resources:
exampleProject:
type: azuredevops:Project
exampleEnvironment:
type: azuredevops:Environment
properties:
projectId: ${exampleProject.id}
exampleCheckBranchControl:
type: azuredevops:CheckBranchControl
properties:
projectId: ${exampleProject.id}
displayName: Managed by Terraform
targetResourceId: ${exampleEnvironment.id}
targetResourceType: environment
allowedBranches: refs/heads/main, refs/heads/features/*
Protect an agent queue
using System.Collections.Generic;
using Pulumi;
using AzureDevOps = Pulumi.AzureDevOps;
return await Deployment.RunAsync(() =>
{
var exampleProject = new AzureDevOps.Project("exampleProject");
var examplePool = new AzureDevOps.Pool("examplePool");
var exampleQueue = new AzureDevOps.Queue("exampleQueue", new()
{
ProjectId = exampleProject.Id,
AgentPoolId = examplePool.Id,
});
var exampleCheckBranchControl = new AzureDevOps.CheckBranchControl("exampleCheckBranchControl", new()
{
ProjectId = exampleProject.Id,
DisplayName = "Managed by Terraform",
TargetResourceId = exampleQueue.Id,
TargetResourceType = "queue",
AllowedBranches = "refs/heads/main, refs/heads/features/*",
});
});
package main
import (
"github.com/pulumi/pulumi-azuredevops/sdk/v2/go/azuredevops"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleProject, err := azuredevops.NewProject(ctx, "exampleProject", nil)
if err != nil {
return err
}
examplePool, err := azuredevops.NewPool(ctx, "examplePool", nil)
if err != nil {
return err
}
exampleQueue, err := azuredevops.NewQueue(ctx, "exampleQueue", &azuredevops.QueueArgs{
ProjectId: exampleProject.ID(),
AgentPoolId: examplePool.ID(),
})
if err != nil {
return err
}
_, err = azuredevops.NewCheckBranchControl(ctx, "exampleCheckBranchControl", &azuredevops.CheckBranchControlArgs{
ProjectId: exampleProject.ID(),
DisplayName: pulumi.String("Managed by Terraform"),
TargetResourceId: exampleQueue.ID(),
TargetResourceType: pulumi.String("queue"),
AllowedBranches: pulumi.String("refs/heads/main, refs/heads/features/*"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azuredevops.Project;
import com.pulumi.azuredevops.Pool;
import com.pulumi.azuredevops.Queue;
import com.pulumi.azuredevops.QueueArgs;
import com.pulumi.azuredevops.CheckBranchControl;
import com.pulumi.azuredevops.CheckBranchControlArgs;
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 exampleProject = new Project("exampleProject");
var examplePool = new Pool("examplePool");
var exampleQueue = new Queue("exampleQueue", QueueArgs.builder()
.projectId(exampleProject.id())
.agentPoolId(examplePool.id())
.build());
var exampleCheckBranchControl = new CheckBranchControl("exampleCheckBranchControl", CheckBranchControlArgs.builder()
.projectId(exampleProject.id())
.displayName("Managed by Terraform")
.targetResourceId(exampleQueue.id())
.targetResourceType("queue")
.allowedBranches("refs/heads/main, refs/heads/features/*")
.build());
}
}
import pulumi
import pulumi_azuredevops as azuredevops
example_project = azuredevops.Project("exampleProject")
example_pool = azuredevops.Pool("examplePool")
example_queue = azuredevops.Queue("exampleQueue",
project_id=example_project.id,
agent_pool_id=example_pool.id)
example_check_branch_control = azuredevops.CheckBranchControl("exampleCheckBranchControl",
project_id=example_project.id,
display_name="Managed by Terraform",
target_resource_id=example_queue.id,
target_resource_type="queue",
allowed_branches="refs/heads/main, refs/heads/features/*")
import * as pulumi from "@pulumi/pulumi";
import * as azuredevops from "@pulumi/azuredevops";
const exampleProject = new azuredevops.Project("exampleProject", {});
const examplePool = new azuredevops.Pool("examplePool", {});
const exampleQueue = new azuredevops.Queue("exampleQueue", {
projectId: exampleProject.id,
agentPoolId: examplePool.id,
});
const exampleCheckBranchControl = new azuredevops.CheckBranchControl("exampleCheckBranchControl", {
projectId: exampleProject.id,
displayName: "Managed by Terraform",
targetResourceId: exampleQueue.id,
targetResourceType: "queue",
allowedBranches: "refs/heads/main, refs/heads/features/*",
});
resources:
exampleProject:
type: azuredevops:Project
examplePool:
type: azuredevops:Pool
exampleQueue:
type: azuredevops:Queue
properties:
projectId: ${exampleProject.id}
agentPoolId: ${examplePool.id}
exampleCheckBranchControl:
type: azuredevops:CheckBranchControl
properties:
projectId: ${exampleProject.id}
displayName: Managed by Terraform
targetResourceId: ${exampleQueue.id}
targetResourceType: queue
allowedBranches: refs/heads/main, refs/heads/features/*
Protect a repository
using System.Collections.Generic;
using Pulumi;
using AzureDevOps = Pulumi.AzureDevOps;
return await Deployment.RunAsync(() =>
{
var exampleProject = new AzureDevOps.Project("exampleProject");
var exampleGit = new AzureDevOps.Git("exampleGit", new()
{
ProjectId = exampleProject.Id,
Initialization = new AzureDevOps.Inputs.GitInitializationArgs
{
InitType = "Clean",
},
});
var exampleCheckBranchControl = new AzureDevOps.CheckBranchControl("exampleCheckBranchControl", new()
{
ProjectId = exampleProject.Id,
DisplayName = "Managed by Terraform",
TargetResourceId = Output.Tuple(exampleProject.Id, exampleGit.Id).Apply(values =>
{
var exampleProjectId = values.Item1;
var exampleGitId = values.Item2;
return $"{exampleProjectId}.{exampleGitId}";
}),
TargetResourceType = "repository",
AllowedBranches = "refs/heads/main, refs/heads/features/*",
});
});
package main
import (
"fmt"
"github.com/pulumi/pulumi-azuredevops/sdk/v2/go/azuredevops"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleProject, err := azuredevops.NewProject(ctx, "exampleProject", nil)
if err != nil {
return err
}
exampleGit, err := azuredevops.NewGit(ctx, "exampleGit", &azuredevops.GitArgs{
ProjectId: exampleProject.ID(),
Initialization: &azuredevops.GitInitializationArgs{
InitType: pulumi.String("Clean"),
},
})
if err != nil {
return err
}
_, err = azuredevops.NewCheckBranchControl(ctx, "exampleCheckBranchControl", &azuredevops.CheckBranchControlArgs{
ProjectId: exampleProject.ID(),
DisplayName: pulumi.String("Managed by Terraform"),
TargetResourceId: pulumi.All(exampleProject.ID(), exampleGit.ID()).ApplyT(func(_args []interface{}) (string, error) {
exampleProjectId := _args[0].(string)
exampleGitId := _args[1].(string)
return fmt.Sprintf("%v.%v", exampleProjectId, exampleGitId), nil
}).(pulumi.StringOutput),
TargetResourceType: pulumi.String("repository"),
AllowedBranches: pulumi.String("refs/heads/main, refs/heads/features/*"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azuredevops.Project;
import com.pulumi.azuredevops.Git;
import com.pulumi.azuredevops.GitArgs;
import com.pulumi.azuredevops.inputs.GitInitializationArgs;
import com.pulumi.azuredevops.CheckBranchControl;
import com.pulumi.azuredevops.CheckBranchControlArgs;
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 exampleProject = new Project("exampleProject");
var exampleGit = new Git("exampleGit", GitArgs.builder()
.projectId(exampleProject.id())
.initialization(GitInitializationArgs.builder()
.initType("Clean")
.build())
.build());
var exampleCheckBranchControl = new CheckBranchControl("exampleCheckBranchControl", CheckBranchControlArgs.builder()
.projectId(exampleProject.id())
.displayName("Managed by Terraform")
.targetResourceId(Output.tuple(exampleProject.id(), exampleGit.id()).applyValue(values -> {
var exampleProjectId = values.t1;
var exampleGitId = values.t2;
return String.format("%s.%s", exampleProjectId,exampleGitId);
}))
.targetResourceType("repository")
.allowedBranches("refs/heads/main, refs/heads/features/*")
.build());
}
}
import pulumi
import pulumi_azuredevops as azuredevops
example_project = azuredevops.Project("exampleProject")
example_git = azuredevops.Git("exampleGit",
project_id=example_project.id,
initialization=azuredevops.GitInitializationArgs(
init_type="Clean",
))
example_check_branch_control = azuredevops.CheckBranchControl("exampleCheckBranchControl",
project_id=example_project.id,
display_name="Managed by Terraform",
target_resource_id=pulumi.Output.all(example_project.id, example_git.id).apply(lambda exampleProjectId, exampleGitId: f"{example_project_id}.{example_git_id}"),
target_resource_type="repository",
allowed_branches="refs/heads/main, refs/heads/features/*")
import * as pulumi from "@pulumi/pulumi";
import * as azuredevops from "@pulumi/azuredevops";
const exampleProject = new azuredevops.Project("exampleProject", {});
const exampleGit = new azuredevops.Git("exampleGit", {
projectId: exampleProject.id,
initialization: {
initType: "Clean",
},
});
const exampleCheckBranchControl = new azuredevops.CheckBranchControl("exampleCheckBranchControl", {
projectId: exampleProject.id,
displayName: "Managed by Terraform",
targetResourceId: pulumi.interpolate`${exampleProject.id}.${exampleGit.id}`,
targetResourceType: "repository",
allowedBranches: "refs/heads/main, refs/heads/features/*",
});
resources:
exampleProject:
type: azuredevops:Project
exampleGit:
type: azuredevops:Git
properties:
projectId: ${exampleProject.id}
initialization:
initType: Clean
exampleCheckBranchControl:
type: azuredevops:CheckBranchControl
properties:
projectId: ${exampleProject.id}
displayName: Managed by Terraform
targetResourceId: ${exampleProject.id}.${exampleGit.id}
targetResourceType: repository
allowedBranches: refs/heads/main, refs/heads/features/*
Protect a variable group
using System.Collections.Generic;
using Pulumi;
using AzureDevOps = Pulumi.AzureDevOps;
return await Deployment.RunAsync(() =>
{
var exampleProject = new AzureDevOps.Project("exampleProject");
var exampleVariableGroup = new AzureDevOps.VariableGroup("exampleVariableGroup", new()
{
ProjectId = exampleProject.Id,
Description = "Example Variable Group Description",
AllowAccess = true,
Variables = new[]
{
new AzureDevOps.Inputs.VariableGroupVariableArgs
{
Name = "key1",
Value = "val1",
},
new AzureDevOps.Inputs.VariableGroupVariableArgs
{
Name = "key2",
SecretValue = "val2",
IsSecret = true,
},
},
});
var exampleCheckBranchControl = new AzureDevOps.CheckBranchControl("exampleCheckBranchControl", new()
{
ProjectId = exampleProject.Id,
DisplayName = "Managed by Terraform",
TargetResourceId = exampleVariableGroup.Id,
TargetResourceType = "variablegroup",
AllowedBranches = "refs/heads/main, refs/heads/features/*",
});
});
package main
import (
"github.com/pulumi/pulumi-azuredevops/sdk/v2/go/azuredevops"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleProject, err := azuredevops.NewProject(ctx, "exampleProject", nil)
if err != nil {
return err
}
exampleVariableGroup, err := azuredevops.NewVariableGroup(ctx, "exampleVariableGroup", &azuredevops.VariableGroupArgs{
ProjectId: exampleProject.ID(),
Description: pulumi.String("Example Variable Group Description"),
AllowAccess: pulumi.Bool(true),
Variables: azuredevops.VariableGroupVariableArray{
&azuredevops.VariableGroupVariableArgs{
Name: pulumi.String("key1"),
Value: pulumi.String("val1"),
},
&azuredevops.VariableGroupVariableArgs{
Name: pulumi.String("key2"),
SecretValue: pulumi.String("val2"),
IsSecret: pulumi.Bool(true),
},
},
})
if err != nil {
return err
}
_, err = azuredevops.NewCheckBranchControl(ctx, "exampleCheckBranchControl", &azuredevops.CheckBranchControlArgs{
ProjectId: exampleProject.ID(),
DisplayName: pulumi.String("Managed by Terraform"),
TargetResourceId: exampleVariableGroup.ID(),
TargetResourceType: pulumi.String("variablegroup"),
AllowedBranches: pulumi.String("refs/heads/main, refs/heads/features/*"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azuredevops.Project;
import com.pulumi.azuredevops.VariableGroup;
import com.pulumi.azuredevops.VariableGroupArgs;
import com.pulumi.azuredevops.inputs.VariableGroupVariableArgs;
import com.pulumi.azuredevops.CheckBranchControl;
import com.pulumi.azuredevops.CheckBranchControlArgs;
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 exampleProject = new Project("exampleProject");
var exampleVariableGroup = new VariableGroup("exampleVariableGroup", VariableGroupArgs.builder()
.projectId(exampleProject.id())
.description("Example Variable Group Description")
.allowAccess(true)
.variables(
VariableGroupVariableArgs.builder()
.name("key1")
.value("val1")
.build(),
VariableGroupVariableArgs.builder()
.name("key2")
.secretValue("val2")
.isSecret(true)
.build())
.build());
var exampleCheckBranchControl = new CheckBranchControl("exampleCheckBranchControl", CheckBranchControlArgs.builder()
.projectId(exampleProject.id())
.displayName("Managed by Terraform")
.targetResourceId(exampleVariableGroup.id())
.targetResourceType("variablegroup")
.allowedBranches("refs/heads/main, refs/heads/features/*")
.build());
}
}
import pulumi
import pulumi_azuredevops as azuredevops
example_project = azuredevops.Project("exampleProject")
example_variable_group = azuredevops.VariableGroup("exampleVariableGroup",
project_id=example_project.id,
description="Example Variable Group Description",
allow_access=True,
variables=[
azuredevops.VariableGroupVariableArgs(
name="key1",
value="val1",
),
azuredevops.VariableGroupVariableArgs(
name="key2",
secret_value="val2",
is_secret=True,
),
])
example_check_branch_control = azuredevops.CheckBranchControl("exampleCheckBranchControl",
project_id=example_project.id,
display_name="Managed by Terraform",
target_resource_id=example_variable_group.id,
target_resource_type="variablegroup",
allowed_branches="refs/heads/main, refs/heads/features/*")
import * as pulumi from "@pulumi/pulumi";
import * as azuredevops from "@pulumi/azuredevops";
const exampleProject = new azuredevops.Project("exampleProject", {});
const exampleVariableGroup = new azuredevops.VariableGroup("exampleVariableGroup", {
projectId: exampleProject.id,
description: "Example Variable Group Description",
allowAccess: true,
variables: [
{
name: "key1",
value: "val1",
},
{
name: "key2",
secretValue: "val2",
isSecret: true,
},
],
});
const exampleCheckBranchControl = new azuredevops.CheckBranchControl("exampleCheckBranchControl", {
projectId: exampleProject.id,
displayName: "Managed by Terraform",
targetResourceId: exampleVariableGroup.id,
targetResourceType: "variablegroup",
allowedBranches: "refs/heads/main, refs/heads/features/*",
});
resources:
exampleProject:
type: azuredevops:Project
exampleVariableGroup:
type: azuredevops:VariableGroup
properties:
projectId: ${exampleProject.id}
description: Example Variable Group Description
allowAccess: true
variables:
- name: key1
value: val1
- name: key2
secretValue: val2
isSecret: true
exampleCheckBranchControl:
type: azuredevops:CheckBranchControl
properties:
projectId: ${exampleProject.id}
displayName: Managed by Terraform
targetResourceId: ${exampleVariableGroup.id}
targetResourceType: variablegroup
allowedBranches: refs/heads/main, refs/heads/features/*
Create CheckBranchControl Resource
new CheckBranchControl(name: string, args: CheckBranchControlArgs, opts?: CustomResourceOptions);
@overload
def CheckBranchControl(resource_name: str,
opts: Optional[ResourceOptions] = None,
allowed_branches: Optional[str] = None,
display_name: Optional[str] = None,
ignore_unknown_protection_status: Optional[bool] = None,
project_id: Optional[str] = None,
target_resource_id: Optional[str] = None,
target_resource_type: Optional[str] = None,
verify_branch_protection: Optional[bool] = None)
@overload
def CheckBranchControl(resource_name: str,
args: CheckBranchControlArgs,
opts: Optional[ResourceOptions] = None)
func NewCheckBranchControl(ctx *Context, name string, args CheckBranchControlArgs, opts ...ResourceOption) (*CheckBranchControl, error)
public CheckBranchControl(string name, CheckBranchControlArgs args, CustomResourceOptions? opts = null)
public CheckBranchControl(String name, CheckBranchControlArgs args)
public CheckBranchControl(String name, CheckBranchControlArgs args, CustomResourceOptions options)
type: azuredevops:CheckBranchControl
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args CheckBranchControlArgs
- 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 CheckBranchControlArgs
- 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 CheckBranchControlArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args CheckBranchControlArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args CheckBranchControlArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
CheckBranchControl Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The CheckBranchControl resource accepts the following input properties:
- Project
Id string The project ID.
- Target
Resource stringId The ID of the resource being protected by the check.
- Target
Resource stringType The type of resource being protected by the check. Valid values:
endpoint
,environment
,queue
,repository
,securefile
,variablegroup
.- Allowed
Branches string The branches allowed to use the resource. Specify a comma separated list of allowed branches in
refs/heads/branch_name
format. To allow deployments from all branches, specify*
.refs/heads/features/* , refs/heads/releases/*
restricts deployments to all branches under features/ or releases/ . Defaults to*
.- Display
Name string The name of the branch control check displayed in the web UI.
- Ignore
Unknown boolProtection Status Allow deployment from branches for which protection status could not be obtained. Only relevant when verify_branch_protection is
true
. Defaults tofalse
.- Verify
Branch boolProtection Validate the branches being deployed are protected. Defaults to
false
.
- Project
Id string The project ID.
- Target
Resource stringId The ID of the resource being protected by the check.
- Target
Resource stringType The type of resource being protected by the check. Valid values:
endpoint
,environment
,queue
,repository
,securefile
,variablegroup
.- Allowed
Branches string The branches allowed to use the resource. Specify a comma separated list of allowed branches in
refs/heads/branch_name
format. To allow deployments from all branches, specify*
.refs/heads/features/* , refs/heads/releases/*
restricts deployments to all branches under features/ or releases/ . Defaults to*
.- Display
Name string The name of the branch control check displayed in the web UI.
- Ignore
Unknown boolProtection Status Allow deployment from branches for which protection status could not be obtained. Only relevant when verify_branch_protection is
true
. Defaults tofalse
.- Verify
Branch boolProtection Validate the branches being deployed are protected. Defaults to
false
.
- project
Id String The project ID.
- target
Resource StringId The ID of the resource being protected by the check.
- target
Resource StringType The type of resource being protected by the check. Valid values:
endpoint
,environment
,queue
,repository
,securefile
,variablegroup
.- allowed
Branches String The branches allowed to use the resource. Specify a comma separated list of allowed branches in
refs/heads/branch_name
format. To allow deployments from all branches, specify*
.refs/heads/features/* , refs/heads/releases/*
restricts deployments to all branches under features/ or releases/ . Defaults to*
.- display
Name String The name of the branch control check displayed in the web UI.
- ignore
Unknown BooleanProtection Status Allow deployment from branches for which protection status could not be obtained. Only relevant when verify_branch_protection is
true
. Defaults tofalse
.- verify
Branch BooleanProtection Validate the branches being deployed are protected. Defaults to
false
.
- project
Id string The project ID.
- target
Resource stringId The ID of the resource being protected by the check.
- target
Resource stringType The type of resource being protected by the check. Valid values:
endpoint
,environment
,queue
,repository
,securefile
,variablegroup
.- allowed
Branches string The branches allowed to use the resource. Specify a comma separated list of allowed branches in
refs/heads/branch_name
format. To allow deployments from all branches, specify*
.refs/heads/features/* , refs/heads/releases/*
restricts deployments to all branches under features/ or releases/ . Defaults to*
.- display
Name string The name of the branch control check displayed in the web UI.
- ignore
Unknown booleanProtection Status Allow deployment from branches for which protection status could not be obtained. Only relevant when verify_branch_protection is
true
. Defaults tofalse
.- verify
Branch booleanProtection Validate the branches being deployed are protected. Defaults to
false
.
- project_
id str The project ID.
- target_
resource_ strid The ID of the resource being protected by the check.
- target_
resource_ strtype The type of resource being protected by the check. Valid values:
endpoint
,environment
,queue
,repository
,securefile
,variablegroup
.- allowed_
branches str The branches allowed to use the resource. Specify a comma separated list of allowed branches in
refs/heads/branch_name
format. To allow deployments from all branches, specify*
.refs/heads/features/* , refs/heads/releases/*
restricts deployments to all branches under features/ or releases/ . Defaults to*
.- display_
name str The name of the branch control check displayed in the web UI.
- ignore_
unknown_ boolprotection_ status Allow deployment from branches for which protection status could not be obtained. Only relevant when verify_branch_protection is
true
. Defaults tofalse
.- verify_
branch_ boolprotection Validate the branches being deployed are protected. Defaults to
false
.
- project
Id String The project ID.
- target
Resource StringId The ID of the resource being protected by the check.
- target
Resource StringType The type of resource being protected by the check. Valid values:
endpoint
,environment
,queue
,repository
,securefile
,variablegroup
.- allowed
Branches String The branches allowed to use the resource. Specify a comma separated list of allowed branches in
refs/heads/branch_name
format. To allow deployments from all branches, specify*
.refs/heads/features/* , refs/heads/releases/*
restricts deployments to all branches under features/ or releases/ . Defaults to*
.- display
Name String The name of the branch control check displayed in the web UI.
- ignore
Unknown BooleanProtection Status Allow deployment from branches for which protection status could not be obtained. Only relevant when verify_branch_protection is
true
. Defaults tofalse
.- verify
Branch BooleanProtection Validate the branches being deployed are protected. Defaults to
false
.
Outputs
All input properties are implicitly available as output properties. Additionally, the CheckBranchControl 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 str
The provider-assigned unique ID for this managed resource.
- id String
The provider-assigned unique ID for this managed resource.
Look up Existing CheckBranchControl Resource
Get an existing CheckBranchControl 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?: CheckBranchControlState, opts?: CustomResourceOptions): CheckBranchControl
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
allowed_branches: Optional[str] = None,
display_name: Optional[str] = None,
ignore_unknown_protection_status: Optional[bool] = None,
project_id: Optional[str] = None,
target_resource_id: Optional[str] = None,
target_resource_type: Optional[str] = None,
verify_branch_protection: Optional[bool] = None) -> CheckBranchControl
func GetCheckBranchControl(ctx *Context, name string, id IDInput, state *CheckBranchControlState, opts ...ResourceOption) (*CheckBranchControl, error)
public static CheckBranchControl Get(string name, Input<string> id, CheckBranchControlState? state, CustomResourceOptions? opts = null)
public static CheckBranchControl get(String name, Output<String> id, CheckBranchControlState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- 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.
- Allowed
Branches string The branches allowed to use the resource. Specify a comma separated list of allowed branches in
refs/heads/branch_name
format. To allow deployments from all branches, specify*
.refs/heads/features/* , refs/heads/releases/*
restricts deployments to all branches under features/ or releases/ . Defaults to*
.- Display
Name string The name of the branch control check displayed in the web UI.
- Ignore
Unknown boolProtection Status Allow deployment from branches for which protection status could not be obtained. Only relevant when verify_branch_protection is
true
. Defaults tofalse
.- Project
Id string The project ID.
- Target
Resource stringId The ID of the resource being protected by the check.
- Target
Resource stringType The type of resource being protected by the check. Valid values:
endpoint
,environment
,queue
,repository
,securefile
,variablegroup
.- Verify
Branch boolProtection Validate the branches being deployed are protected. Defaults to
false
.
- Allowed
Branches string The branches allowed to use the resource. Specify a comma separated list of allowed branches in
refs/heads/branch_name
format. To allow deployments from all branches, specify*
.refs/heads/features/* , refs/heads/releases/*
restricts deployments to all branches under features/ or releases/ . Defaults to*
.- Display
Name string The name of the branch control check displayed in the web UI.
- Ignore
Unknown boolProtection Status Allow deployment from branches for which protection status could not be obtained. Only relevant when verify_branch_protection is
true
. Defaults tofalse
.- Project
Id string The project ID.
- Target
Resource stringId The ID of the resource being protected by the check.
- Target
Resource stringType The type of resource being protected by the check. Valid values:
endpoint
,environment
,queue
,repository
,securefile
,variablegroup
.- Verify
Branch boolProtection Validate the branches being deployed are protected. Defaults to
false
.
- allowed
Branches String The branches allowed to use the resource. Specify a comma separated list of allowed branches in
refs/heads/branch_name
format. To allow deployments from all branches, specify*
.refs/heads/features/* , refs/heads/releases/*
restricts deployments to all branches under features/ or releases/ . Defaults to*
.- display
Name String The name of the branch control check displayed in the web UI.
- ignore
Unknown BooleanProtection Status Allow deployment from branches for which protection status could not be obtained. Only relevant when verify_branch_protection is
true
. Defaults tofalse
.- project
Id String The project ID.
- target
Resource StringId The ID of the resource being protected by the check.
- target
Resource StringType The type of resource being protected by the check. Valid values:
endpoint
,environment
,queue
,repository
,securefile
,variablegroup
.- verify
Branch BooleanProtection Validate the branches being deployed are protected. Defaults to
false
.
- allowed
Branches string The branches allowed to use the resource. Specify a comma separated list of allowed branches in
refs/heads/branch_name
format. To allow deployments from all branches, specify*
.refs/heads/features/* , refs/heads/releases/*
restricts deployments to all branches under features/ or releases/ . Defaults to*
.- display
Name string The name of the branch control check displayed in the web UI.
- ignore
Unknown booleanProtection Status Allow deployment from branches for which protection status could not be obtained. Only relevant when verify_branch_protection is
true
. Defaults tofalse
.- project
Id string The project ID.
- target
Resource stringId The ID of the resource being protected by the check.
- target
Resource stringType The type of resource being protected by the check. Valid values:
endpoint
,environment
,queue
,repository
,securefile
,variablegroup
.- verify
Branch booleanProtection Validate the branches being deployed are protected. Defaults to
false
.
- allowed_
branches str The branches allowed to use the resource. Specify a comma separated list of allowed branches in
refs/heads/branch_name
format. To allow deployments from all branches, specify*
.refs/heads/features/* , refs/heads/releases/*
restricts deployments to all branches under features/ or releases/ . Defaults to*
.- display_
name str The name of the branch control check displayed in the web UI.
- ignore_
unknown_ boolprotection_ status Allow deployment from branches for which protection status could not be obtained. Only relevant when verify_branch_protection is
true
. Defaults tofalse
.- project_
id str The project ID.
- target_
resource_ strid The ID of the resource being protected by the check.
- target_
resource_ strtype The type of resource being protected by the check. Valid values:
endpoint
,environment
,queue
,repository
,securefile
,variablegroup
.- verify_
branch_ boolprotection Validate the branches being deployed are protected. Defaults to
false
.
- allowed
Branches String The branches allowed to use the resource. Specify a comma separated list of allowed branches in
refs/heads/branch_name
format. To allow deployments from all branches, specify*
.refs/heads/features/* , refs/heads/releases/*
restricts deployments to all branches under features/ or releases/ . Defaults to*
.- display
Name String The name of the branch control check displayed in the web UI.
- ignore
Unknown BooleanProtection Status Allow deployment from branches for which protection status could not be obtained. Only relevant when verify_branch_protection is
true
. Defaults tofalse
.- project
Id String The project ID.
- target
Resource StringId The ID of the resource being protected by the check.
- target
Resource StringType The type of resource being protected by the check. Valid values:
endpoint
,environment
,queue
,repository
,securefile
,variablegroup
.- verify
Branch BooleanProtection Validate the branches being deployed are protected. Defaults to
false
.
Import
Importing this resource is not supported.
Package Details
- Repository
- Azure DevOps pulumi/pulumi-azuredevops
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
azuredevops
Terraform Provider.