Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azuredevops_git_permissions fails to apply on Azure DevOps Server 2022 #1217

Open
paddymorgan84 opened this issue Nov 7, 2024 · 4 comments
Labels

Comments

@paddymorgan84
Copy link
Contributor

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform (and Azure DevOps Provider) Version

Terraform: v1.9.8
Azure DevOps Provider: 1.4.0

Affected Resource(s)

  • azuredevops_git_permissions

Terraform Configuration Files

data "azuredevops_project" "Project" {
  name = var.project_name
}

data "azuredevops_identity_group" "contributors" {
  project_id = data.azuredevops_project.MedisoftEMR.id
  name       = "[${var.project_name}]\\Contributors"
}

resource "azuredevops_git_permissions" "contributors-permissions" {
  project_id    = data.azuredevops_project.Project.id
  repository_id = var.repository_id
  principal     = data.azuredevops_identity_group.contributors.id
  permissions = {
    PolicyExempt            = "Deny"
    PullRequestBypassPolicy = "Deny"
    GenericContribute       = "Allow"
    PullRequestContribute   = "Allow"
    CreateBranch            = "Allow"
    CreateTag               = "Allow"
    DeleteRepository        = "Deny"
    EditPolicies            = "Deny"
    ForcePush               = "Deny"
    ManageNote              = "Allow"
    ManagePermissions       = "Deny"
    GenericRead             = "Allow"
    RemoveOthersLocks       = "Deny"
    RenameRepository        = "Deny"
  }
}

Debug Output

Panic Output

Expected Behavior

Permissions should have been set for the contributors project group at the repository level.

Actual Behavior

An error is thrown:

 Error: The string must have at least one character.
│ Parameter name: descriptors element.IdentityType
│ 
│   with module.repository["monitoring"].module.permissions.azuredevops_git_permissions.contributors-permissions,
│   on modules/repository/modules/permissions/main.tf line 10, in resource "azuredevops_git_permissions" "contributors-permissions":
│   10: resource "azuredevops_git_permissions" "contributors-permissions" {

Steps to Reproduce

  1. terraform apply

Important Factoids

Nothing particularly atypical, but I am using Azure DevOps Server 2022 rather than Azure DevOps services, which means that rather than using the azuredevops_group data source used in the documentation I'm using azuredevops_identity_group instead.

References

  • #0000
@xuzhang3
Copy link
Collaborator

xuzhang3 commented Nov 8, 2024

@paddymorgan84 ADO server is not supported by this provider. All resources target ADO services. There might some API or feature difference between ADO service and ADO service

@paddymorgan84
Copy link
Contributor Author

Thanks @xuzhang3. I didn't realise this was the case, it seems odd because there are resources such as azuredevops_identity_group that have been created specifically to handle on premise Azure DevOps?

@xuzhang3
Copy link
Collaborator

@paddymorgan84 Most of the API between ADO service and ADO service are same but some are different. azuredevops_identity_group was originally added to support the on-premise/non-cloud APIs.

@balazs92117
Copy link

I have the same problem on ADO service, so it's not happening only on on-prem ADO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants