microsoft / terraform-provider-azuredevops

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

Add ability to add Cross-Repository policies at project level #749

Open solidaris-grahamturk opened 1 year ago

solidaris-grahamturk commented 1 year ago

Add ability to add Cross-Repository policies rather than having to specify these polices at branch level. This makes for a cleaner and more efficient setup rather than having to duplicate these polices across multiple branches within a repo. azuredevops_project

Community Note

Description

New or Affected Resource(s)

Potential Terraform Configuration

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key.

References

toomeydanielj commented 1 year ago

@turkster You can have multiple scope blocks in a single policy (one for each branch you want to apply the policy to). Additionally, you can set the repository_id to null and it'll apply the policy to all repositories in the project.

    scope {
      repository_id  = null # All repositories in the project
      repository_ref = "refs/heads/development"
      match_type     = "Exact"
    }

    scope {
      repository_id  = null # All repositories in the project
      repository_ref = "refs/heads/production"
      match_type     = "Exact"
    }

If you want the policy to apply to all branches in all repositories within the project, you can use a match_type of Prefix and specify this pattern.

scope {
  repository_id  = null # All repositories in the project
  repository_ref = "refs/heads/"
  match_type     = "Prefix"
}