In azure devops pipelines I have a service connection for a docker container registry. Whenever I create a pipelines I allow the pipelines to use this service connections from:
project settings > Service connection > Container registry > security > Pipeline permissions
As per the following image:
How to modify the below terraform config to add permission to access a given service connection?
resource "azuredevops_build_definition" "project" {
project_id = "xxx"
name = "xxx"
path = "\\"
repository {
repo_type = "xxx"
repo_id = "xxx"
branch_name = "xxx"
yml_path = "azure-pipelines.yml"
service_connection_id = "xxx"
}
}
Had to use terraform's azuredevops_pipeline_authorization
resource "azuredevops_build_definition" "project" {
project_id = "xxx"
name = "xxx"
path = "\\"
repository {
repo_type = "xxx"
repo_id = "xxx"
branch_name = "xxx"
yml_path = "azure-pipelines.yml"
service_connection_id = "xxx"
}
}
resource "azuredevops_pipeline_authorization" "acr" {
project_id = "xxx"
resource_id = "xxx" # ID of service connection
type = "endpoint"
pipeline_id = azuredevops_build_definition.example.id
}