azuredevops_branch_policy_status_check

Manages a status check branch policy within Azure DevOps.

Example Usage

resource "azuredevops_project" "example" {
  name               = "Example Project"
  visibility         = "private"
  version_control    = "Git"
  work_item_template = "Agile"
  features = {
    "testplans" = "disabled"
    "artifacts" = "disabled"
  }
  description = "Managed by Terraform"
}

resource "azuredevops_git_repository" "example" {
  project_id = azuredevops_project.example.id
  name       = "Example Repository"
  initialization {
    init_type = "Clean"
  }
}

resource "azuredevops_user_entitlement" "example" {
  principal_name       = "mail@email.com"
  account_license_type = "basic"
}

resource "azuredevops_branch_policy_status_check" "example" {
  project_id = azuredevops_project.example.id

  enabled  = true
  blocking = true

  settings {
    name                 = "Release"
    author_id            = azuredevops_user_entitlement.example.id
    invalidate_on_update = true
    applicability        = "conditional"
    display_name         = "PreCheck"

    scope {
      repository_id  = azuredevops_git_repository.example.id
      repository_ref = azuredevops_git_repository.example.default_branch
      match_type     = "Exact"
    }

    scope {
      match_type     = "DefaultBranch"
    }
  }
}

Argument Reference

The following arguments are supported:

settings block supports the following:

Attributes Reference

In addition to all arguments above, the following attributes are exported:

Import

Azure DevOps Branch Policies can be imported using the project ID and policy configuration ID:

terraform import azuredevops_branch_policy_status_check.example 00000000-0000-0000-0000-000000000000/0