azuredevops.RepositoryPolicyMaxPathLength

Explore with Pulumi AI

Manage a max path length repository policy within Azure DevOps project.

If both project and project policy are enabled, the repository policy has high priority.

Example Usage

using System.Collections.Generic;
using Pulumi;
using AzureDevOps = Pulumi.AzureDevOps;

return await Deployment.RunAsync(() => 
{
    var exampleProject = new AzureDevOps.Project("exampleProject", new()
    {
        Visibility = "private",
        VersionControl = "Git",
        WorkItemTemplate = "Agile",
        Description = "Managed by Terraform",
    });

    var exampleGit = new AzureDevOps.Git("exampleGit", new()
    {
        ProjectId = exampleProject.Id,
        Initialization = new AzureDevOps.Inputs.GitInitializationArgs
        {
            InitType = "Clean",
        },
    });

    var exampleRepositoryPolicyMaxPathLength = new AzureDevOps.RepositoryPolicyMaxPathLength("exampleRepositoryPolicyMaxPathLength", new()
    {
        ProjectId = exampleProject.Id,
        Enabled = true,
        Blocking = true,
        MaxPathLength = 500,
        RepositoryIds = new[]
        {
            exampleGit.Id,
        },
    });

});
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", &azuredevops.ProjectArgs{
			Visibility:       pulumi.String("private"),
			VersionControl:   pulumi.String("Git"),
			WorkItemTemplate: pulumi.String("Agile"),
			Description:      pulumi.String("Managed by Terraform"),
		})
		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.NewRepositoryPolicyMaxPathLength(ctx, "exampleRepositoryPolicyMaxPathLength", &azuredevops.RepositoryPolicyMaxPathLengthArgs{
			ProjectId:     exampleProject.ID(),
			Enabled:       pulumi.Bool(true),
			Blocking:      pulumi.Bool(true),
			MaxPathLength: pulumi.Int(500),
			RepositoryIds: pulumi.StringArray{
				exampleGit.ID(),
			},
		})
		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.ProjectArgs;
import com.pulumi.azuredevops.Git;
import com.pulumi.azuredevops.GitArgs;
import com.pulumi.azuredevops.inputs.GitInitializationArgs;
import com.pulumi.azuredevops.RepositoryPolicyMaxPathLength;
import com.pulumi.azuredevops.RepositoryPolicyMaxPathLengthArgs;
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", ProjectArgs.builder()        
            .visibility("private")
            .versionControl("Git")
            .workItemTemplate("Agile")
            .description("Managed by Terraform")
            .build());

        var exampleGit = new Git("exampleGit", GitArgs.builder()        
            .projectId(exampleProject.id())
            .initialization(GitInitializationArgs.builder()
                .initType("Clean")
                .build())
            .build());

        var exampleRepositoryPolicyMaxPathLength = new RepositoryPolicyMaxPathLength("exampleRepositoryPolicyMaxPathLength", RepositoryPolicyMaxPathLengthArgs.builder()        
            .projectId(exampleProject.id())
            .enabled(true)
            .blocking(true)
            .maxPathLength(500)
            .repositoryIds(exampleGit.id())
            .build());

    }
}
import pulumi
import pulumi_azuredevops as azuredevops

example_project = azuredevops.Project("exampleProject",
    visibility="private",
    version_control="Git",
    work_item_template="Agile",
    description="Managed by Terraform")
example_git = azuredevops.Git("exampleGit",
    project_id=example_project.id,
    initialization=azuredevops.GitInitializationArgs(
        init_type="Clean",
    ))
example_repository_policy_max_path_length = azuredevops.RepositoryPolicyMaxPathLength("exampleRepositoryPolicyMaxPathLength",
    project_id=example_project.id,
    enabled=True,
    blocking=True,
    max_path_length=500,
    repository_ids=[example_git.id])
import * as pulumi from "@pulumi/pulumi";
import * as azuredevops from "@pulumi/azuredevops";

const exampleProject = new azuredevops.Project("exampleProject", {
    visibility: "private",
    versionControl: "Git",
    workItemTemplate: "Agile",
    description: "Managed by Terraform",
});
const exampleGit = new azuredevops.Git("exampleGit", {
    projectId: exampleProject.id,
    initialization: {
        initType: "Clean",
    },
});
const exampleRepositoryPolicyMaxPathLength = new azuredevops.RepositoryPolicyMaxPathLength("exampleRepositoryPolicyMaxPathLength", {
    projectId: exampleProject.id,
    enabled: true,
    blocking: true,
    maxPathLength: 500,
    repositoryIds: [exampleGit.id],
});
resources:
  exampleProject:
    type: azuredevops:Project
    properties:
      visibility: private
      versionControl: Git
      workItemTemplate: Agile
      description: Managed by Terraform
  exampleGit:
    type: azuredevops:Git
    properties:
      projectId: ${exampleProject.id}
      initialization:
        initType: Clean
  exampleRepositoryPolicyMaxPathLength:
    type: azuredevops:RepositoryPolicyMaxPathLength
    properties:
      projectId: ${exampleProject.id}
      enabled: true
      blocking: true
      maxPathLength: 500
      repositoryIds:
        - ${exampleGit.id}
using System.Collections.Generic;
using Pulumi;
using AzureDevOps = Pulumi.AzureDevOps;

return await Deployment.RunAsync(() => 
{
    var exampleProject = new AzureDevOps.Project("exampleProject", new()
    {
        Visibility = "private",
        VersionControl = "Git",
        WorkItemTemplate = "Agile",
        Description = "Managed by Terraform",
    });

    var exampleRepositoryPolicyMaxPathLength = new AzureDevOps.RepositoryPolicyMaxPathLength("exampleRepositoryPolicyMaxPathLength", new()
    {
        ProjectId = exampleProject.Id,
        Enabled = true,
        Blocking = true,
        MaxPathLength = 1000,
    });

});
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", &azuredevops.ProjectArgs{
			Visibility:       pulumi.String("private"),
			VersionControl:   pulumi.String("Git"),
			WorkItemTemplate: pulumi.String("Agile"),
			Description:      pulumi.String("Managed by Terraform"),
		})
		if err != nil {
			return err
		}
		_, err = azuredevops.NewRepositoryPolicyMaxPathLength(ctx, "exampleRepositoryPolicyMaxPathLength", &azuredevops.RepositoryPolicyMaxPathLengthArgs{
			ProjectId:     exampleProject.ID(),
			Enabled:       pulumi.Bool(true),
			Blocking:      pulumi.Bool(true),
			MaxPathLength: pulumi.Int(1000),
		})
		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.ProjectArgs;
import com.pulumi.azuredevops.RepositoryPolicyMaxPathLength;
import com.pulumi.azuredevops.RepositoryPolicyMaxPathLengthArgs;
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", ProjectArgs.builder()        
            .visibility("private")
            .versionControl("Git")
            .workItemTemplate("Agile")
            .description("Managed by Terraform")
            .build());

        var exampleRepositoryPolicyMaxPathLength = new RepositoryPolicyMaxPathLength("exampleRepositoryPolicyMaxPathLength", RepositoryPolicyMaxPathLengthArgs.builder()        
            .projectId(exampleProject.id())
            .enabled(true)
            .blocking(true)
            .maxPathLength(1000)
            .build());

    }
}
import pulumi
import pulumi_azuredevops as azuredevops

example_project = azuredevops.Project("exampleProject",
    visibility="private",
    version_control="Git",
    work_item_template="Agile",
    description="Managed by Terraform")
example_repository_policy_max_path_length = azuredevops.RepositoryPolicyMaxPathLength("exampleRepositoryPolicyMaxPathLength",
    project_id=example_project.id,
    enabled=True,
    blocking=True,
    max_path_length=1000)
import * as pulumi from "@pulumi/pulumi";
import * as azuredevops from "@pulumi/azuredevops";

const exampleProject = new azuredevops.Project("exampleProject", {
    visibility: "private",
    versionControl: "Git",
    workItemTemplate: "Agile",
    description: "Managed by Terraform",
});
const exampleRepositoryPolicyMaxPathLength = new azuredevops.RepositoryPolicyMaxPathLength("exampleRepositoryPolicyMaxPathLength", {
    projectId: exampleProject.id,
    enabled: true,
    blocking: true,
    maxPathLength: 1000,
});
resources:
  exampleProject:
    type: azuredevops:Project
    properties:
      visibility: private
      versionControl: Git
      workItemTemplate: Agile
      description: Managed by Terraform
  exampleRepositoryPolicyMaxPathLength:
    type: azuredevops:RepositoryPolicyMaxPathLength
    properties:
      projectId: ${exampleProject.id}
      enabled: true
      blocking: true
      maxPathLength: 1000

Create RepositoryPolicyMaxPathLength Resource

new RepositoryPolicyMaxPathLength(name: string, args: RepositoryPolicyMaxPathLengthArgs, opts?: CustomResourceOptions);
@overload
def RepositoryPolicyMaxPathLength(resource_name: str,
                                  opts: Optional[ResourceOptions] = None,
                                  blocking: Optional[bool] = None,
                                  enabled: Optional[bool] = None,
                                  max_path_length: Optional[int] = None,
                                  project_id: Optional[str] = None,
                                  repository_ids: Optional[Sequence[str]] = None)
@overload
def RepositoryPolicyMaxPathLength(resource_name: str,
                                  args: RepositoryPolicyMaxPathLengthArgs,
                                  opts: Optional[ResourceOptions] = None)
func NewRepositoryPolicyMaxPathLength(ctx *Context, name string, args RepositoryPolicyMaxPathLengthArgs, opts ...ResourceOption) (*RepositoryPolicyMaxPathLength, error)
public RepositoryPolicyMaxPathLength(string name, RepositoryPolicyMaxPathLengthArgs args, CustomResourceOptions? opts = null)
public RepositoryPolicyMaxPathLength(String name, RepositoryPolicyMaxPathLengthArgs args)
public RepositoryPolicyMaxPathLength(String name, RepositoryPolicyMaxPathLengthArgs args, CustomResourceOptions options)
type: azuredevops:RepositoryPolicyMaxPathLength
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

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

RepositoryPolicyMaxPathLength 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 RepositoryPolicyMaxPathLength resource accepts the following input properties:

MaxPathLength int

Block pushes that introduce paths that exceed the specified length.

ProjectId string

The ID of the project in which the policy will be created.

Blocking bool

A flag indicating if the policy should be blocking. Defaults to true.

Enabled bool

A flag indicating if the policy should be enabled. Defaults to true.

RepositoryIds List<string>

Control whether the policy is enabled for the repository or the project. If repository_ids not configured, the policy will be set to the project.

MaxPathLength int

Block pushes that introduce paths that exceed the specified length.

ProjectId string

The ID of the project in which the policy will be created.

Blocking bool

A flag indicating if the policy should be blocking. Defaults to true.

Enabled bool

A flag indicating if the policy should be enabled. Defaults to true.

RepositoryIds []string

Control whether the policy is enabled for the repository or the project. If repository_ids not configured, the policy will be set to the project.

maxPathLength Integer

Block pushes that introduce paths that exceed the specified length.

projectId String

The ID of the project in which the policy will be created.

blocking Boolean

A flag indicating if the policy should be blocking. Defaults to true.

enabled Boolean

A flag indicating if the policy should be enabled. Defaults to true.

repositoryIds List<String>

Control whether the policy is enabled for the repository or the project. If repository_ids not configured, the policy will be set to the project.

maxPathLength number

Block pushes that introduce paths that exceed the specified length.

projectId string

The ID of the project in which the policy will be created.

blocking boolean

A flag indicating if the policy should be blocking. Defaults to true.

enabled boolean

A flag indicating if the policy should be enabled. Defaults to true.

repositoryIds string[]

Control whether the policy is enabled for the repository or the project. If repository_ids not configured, the policy will be set to the project.

max_path_length int

Block pushes that introduce paths that exceed the specified length.

project_id str

The ID of the project in which the policy will be created.

blocking bool

A flag indicating if the policy should be blocking. Defaults to true.

enabled bool

A flag indicating if the policy should be enabled. Defaults to true.

repository_ids Sequence[str]

Control whether the policy is enabled for the repository or the project. If repository_ids not configured, the policy will be set to the project.

maxPathLength Number

Block pushes that introduce paths that exceed the specified length.

projectId String

The ID of the project in which the policy will be created.

blocking Boolean

A flag indicating if the policy should be blocking. Defaults to true.

enabled Boolean

A flag indicating if the policy should be enabled. Defaults to true.

repositoryIds List<String>

Control whether the policy is enabled for the repository or the project. If repository_ids not configured, the policy will be set to the project.

Outputs

All input properties are implicitly available as output properties. Additionally, the RepositoryPolicyMaxPathLength 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 RepositoryPolicyMaxPathLength Resource

Get an existing RepositoryPolicyMaxPathLength 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?: RepositoryPolicyMaxPathLengthState, opts?: CustomResourceOptions): RepositoryPolicyMaxPathLength
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        blocking: Optional[bool] = None,
        enabled: Optional[bool] = None,
        max_path_length: Optional[int] = None,
        project_id: Optional[str] = None,
        repository_ids: Optional[Sequence[str]] = None) -> RepositoryPolicyMaxPathLength
func GetRepositoryPolicyMaxPathLength(ctx *Context, name string, id IDInput, state *RepositoryPolicyMaxPathLengthState, opts ...ResourceOption) (*RepositoryPolicyMaxPathLength, error)
public static RepositoryPolicyMaxPathLength Get(string name, Input<string> id, RepositoryPolicyMaxPathLengthState? state, CustomResourceOptions? opts = null)
public static RepositoryPolicyMaxPathLength get(String name, Output<String> id, RepositoryPolicyMaxPathLengthState 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.
The following state arguments are supported:
Blocking bool

A flag indicating if the policy should be blocking. Defaults to true.

Enabled bool

A flag indicating if the policy should be enabled. Defaults to true.

MaxPathLength int

Block pushes that introduce paths that exceed the specified length.

ProjectId string

The ID of the project in which the policy will be created.

RepositoryIds List<string>

Control whether the policy is enabled for the repository or the project. If repository_ids not configured, the policy will be set to the project.

Blocking bool

A flag indicating if the policy should be blocking. Defaults to true.

Enabled bool

A flag indicating if the policy should be enabled. Defaults to true.

MaxPathLength int

Block pushes that introduce paths that exceed the specified length.

ProjectId string

The ID of the project in which the policy will be created.

RepositoryIds []string

Control whether the policy is enabled for the repository or the project. If repository_ids not configured, the policy will be set to the project.

blocking Boolean

A flag indicating if the policy should be blocking. Defaults to true.

enabled Boolean

A flag indicating if the policy should be enabled. Defaults to true.

maxPathLength Integer

Block pushes that introduce paths that exceed the specified length.

projectId String

The ID of the project in which the policy will be created.

repositoryIds List<String>

Control whether the policy is enabled for the repository or the project. If repository_ids not configured, the policy will be set to the project.

blocking boolean

A flag indicating if the policy should be blocking. Defaults to true.

enabled boolean

A flag indicating if the policy should be enabled. Defaults to true.

maxPathLength number

Block pushes that introduce paths that exceed the specified length.

projectId string

The ID of the project in which the policy will be created.

repositoryIds string[]

Control whether the policy is enabled for the repository or the project. If repository_ids not configured, the policy will be set to the project.

blocking bool

A flag indicating if the policy should be blocking. Defaults to true.

enabled bool

A flag indicating if the policy should be enabled. Defaults to true.

max_path_length int

Block pushes that introduce paths that exceed the specified length.

project_id str

The ID of the project in which the policy will be created.

repository_ids Sequence[str]

Control whether the policy is enabled for the repository or the project. If repository_ids not configured, the policy will be set to the project.

blocking Boolean

A flag indicating if the policy should be blocking. Defaults to true.

enabled Boolean

A flag indicating if the policy should be enabled. Defaults to true.

maxPathLength Number

Block pushes that introduce paths that exceed the specified length.

projectId String

The ID of the project in which the policy will be created.

repositoryIds List<String>

Control whether the policy is enabled for the repository or the project. If repository_ids not configured, the policy will be set to the project.

Import

Azure DevOps repository policies can be imported using the projectID/policyID or projectName/policyID

 $ pulumi import azuredevops:index/repositoryPolicyMaxPathLength:RepositoryPolicyMaxPathLength example 00000000-0000-0000-0000-000000000000/0

Package Details

Repository
Azure DevOps pulumi/pulumi-azuredevops
License
Apache-2.0
Notes

This Pulumi package is based on the azuredevops Terraform Provider.