| layout | azuredevops |
|---|---|
| page_title | AzureDevops: azuredevops_branch_policy_comment_resolution |
| description | Configure a comment resolution policy for your branch within Azure DevOps project. |
Configure a comment resolution policy for your branch within Azure DevOps project.
resource "azuredevops_project" "example" {
name = "Example Project"
}
resource "azuredevops_git_repository" "example" {
project_id = azuredevops_project.example.id
name = "Example Repository"
initialization {
init_type = "Clean"
}
}
resource "azuredevops_branch_policy_comment_resolution" "example" {
project_id = azuredevops_project.example.id
enabled = true
blocking = true
settings {
scope {
repository_id = azuredevops_git_repository.example.id
repository_ref = azuredevops_git_repository.example.default_branch
match_type = "Exact"
}
scope {
repository_id = azuredevops_git_repository.example.id
repository_ref = "refs/heads/releases"
match_type = "Prefix"
}
scope {
match_type = "DefaultBranch"
}
}
}The following arguments are supported:
-
project_id- (Required) The ID of the project in which the policy will be created. -
settings- (Required) Asettingsblock as defined below. Configuration for the policy. This block must be defined exactly once.
-
enabled- (Optional) A flag indicating if the policy should be enabled. Defaults totrue. -
blocking- (Optional) A flag indicating if the policy should be blocking. Defaults totrue.
A settings block supports the following:
scope(Required) Ascopeblock as defined below. Controls which repositories and branches the policy will be enabled for. This block must be defined at least once.
A scope block supports the following:
-
repository_id- (Optional) The repository ID. Needed only if the scope of the policy will be limited to a single repository. Ifmatch_typeisDefaultBranch, this should not be defined. -
repository_ref- (Optional) The ref pattern to use for the match whenmatch_typeother thanDefaultBranch. Ifmatch_typeisExact, this should be a qualified ref such asrefs/heads/master. Ifmatch_typeisPrefix, this should be a ref path such asrefs/heads/releases. -
match_type(Optional) The match type to use when applying the policy. Supported values areExact(default),PrefixorDefaultBranch.
In addition to all arguments above, the following attributes are exported:
id- The ID of branch policy configuration.
The timeouts block allows you to specify timeouts for certain actions:
create- (Defaults to 5 minutes) Used when creating the Comment Resolution Branch Policy.read- (Defaults to 2 minute) Used when retrieving the Comment Resolution Branch Policy.update- (Defaults to 5 minutes) Used when updating the Comment Resolution Branch Policy.delete- (Defaults to 5 minutes) Used when deleting the Comment Resolution Branch Policy.
Azure DevOps Branch Policies can be imported using the project ID and policy configuration ID:
terraform import azuredevops_branch_policy_comment_resolution.example 00000000-0000-0000-0000-000000000000/0