Manage author email pattern repository policy within Azure DevOps project.
resource "azuredevops_project" "example" {
name = "Example Project"
visibility = "private"
version_control = "Git"
work_item_template = "Agile"
description = "Managed by Terraform"
}
resource "azuredevops_git_repository" "example" {
project_id = azuredevops_project.example.id
name = "Example Repository"
initialization {
init_type = "Clean"
}
}
resource "azuredevops_repository_policy_author_email_pattern" "example" {
project_id = azuredevops_project.example.id
enabled = true
blocking = true
author_email_patterns = ["user1@test.com", "user2@test.com"]
repository_ids = [azuredevops_git_repository.example.id]
}
resource "azuredevops_project" "example" {
name = "Example Project"
visibility = "private"
version_control = "Git"
work_item_template = "Agile"
description = "Managed by Terraform"
}
resource "azuredevops_repository_policy_author_email_pattern" "example" {
project_id = azuredevops_project.example.id
enabled = true
blocking = true
author_email_patterns = ["user1@test.com", "user2@test.com"]
}
The following arguments are supported:
project_id
- (Required) The ID of the project in which the policy will be created.enabled
- (Optional) A flag indicating if the policy should be enabled. Defaults to true
.blocking
- (Optional) A flag indicating if the policy should be blocking. Defaults to true
.author_email_patterns
- (Required) Block pushes with a commit author email that does not match the patterns. You can specify exact emails or use wildcards.
Email patterns prefixed with "!" are excluded. Order is important.repository_ids
(Optional) 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. In addition to all arguments above, the following attributes are exported:
id
- The ID of repository policy configuration.Azure DevOps Branch Policies can be imported using the project ID and policy configuration ID:
terraform import azuredevops_repository_policy_author_email_pattern.example 00000000-0000-0000-0000-000000000000/0