microsoft / terraform-provider-azuredevops

Terraform Azure DevOps provider
https://www.terraform.io/docs/providers/azuredevops/
MIT License
387 stars 278 forks source link

Add support for build completion trigger in `azuredevops_build_definition` #1192

Closed mouellet closed 1 week ago

mouellet commented 1 month ago

Community Note

Description

The azuredevops_build_definition resource has support for CI and Pull Request triggers, but not for Build Completion. This can be defined using pipeline resources in YAML, but that doesn't support templating or in YAML template...

New or Affected Resource(s)

Potential Terraform Configuration

data "azuredevops_project" "example" {
  name = "Example Project"
}

data "azuredevops_build_definition" "other" {
  project_id = data.azuredevops_project.example.id
  name = "other"
}

resource "azuredevops_build_definition" "example" {
  project_id = azuredevops_project.example.id
  name       = "Example Build Definition"
  path       = "\\ExampleFolder"

  build_completion_trigger {
    branch_filter {
      include = ["main"]
      exclude = ["test", "regression"]
    }
    build_definition_id       = data.azuredevops_build_definition.other.id
    requires_successful_build = true
  }
  ...
}

References