microsoft / terraform-provider-azuredevops

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

Cannot grant pipeline authorization for cross-project repository #1010

Closed Mikel-Landa closed 3 months ago

Mikel-Landa commented 3 months ago

Community Note

Terraform (and Azure DevOps Provider) Version

Azure Devops: 1.0.1 Terraform: v1.5.5

Affected Resource(s)

Terraform Configuration Files

resource "azuredevops_pipeline_authorization" "gitops_repository" {
  project_id  = var.project_id
  resource_id = "${var.extra_projects["GitOps"].id}.${data.azuredevops_git_repository.gitops.id}"
  type        = "repository"
  pipeline_id = azuredevops_build_definition.this.id
}

Expected Behavior

Actual Behavior

Error:  creating authorized resource: Resource id exceeds maximum length of 100.

  with azuredevops_pipeline_authorization.gitops_repository,
  on main.tf line 74, in resource "azuredevops_pipeline_authorization" "gitops_repository":
  74: resource "azuredevops_pipeline_authorization" "gitops_repository" {

Steps to Reproduce

Try to reference a cross-project repository in authorization

What I see happening when I grant permission through the UI is a call to the endpoint with a body type of PipelinePermissions[], meanwhile I believe the terraform resource is calling with the resource type which should be the one throwing the error, as with the former, the resourceId goes in the url and not in the body.

I've looked at the definitions here: https://learn.microsoft.com/en-us/rest/api/azure/devops/approvalsandchecks/pipeline-permissions/update-pipeline-permisions-for-resource?view=azure-devops-rest-7.1&tabs=HTTP#request-body

xuzhang3 commented 3 months ago

@Mikel-Landa this feature has been supported by #973 , will be available in the next version.

Mikel-Landa commented 3 months ago

Ok, great. I'll close the issue then. Thanks.