Closed chrisnavar closed 3 months ago
Is there any update on this issue?
I was running into a similiar issue. Turns out that the group membership has to receive the legacy identity descriptors in the members array.
Something like this should work fine
variable "git_repo_reader_members" {
type = list(string)
description = "A list of user or group descriptors that will become members of the readers group."
default = ["john.doe@contoso.com"]
}
resource "azuredevops_group" "azuredevops_groups" {
for_each = local.devops_default_group_git_permissions
scope = data.azuredevops_project.contoso.id
display_name = "azuredevops_group"
}
data "azuredevops_users" "azdo_users" {
for_each = toset(var.git_repo_reader_members)
principal_name = each.key
}
resource "azuredevops_group_membership" "azuredevops_reader_group_membership" {
for_each = toset(var.git_repo_reader_members)
group = azuredevops_group.azuredevops_groups["reader"].descriptor
members = [one(data.azuredevops_users.azdo_users[each.key].users).descriptor]
mode = "add"
}
@chrisnavar Cannot add the users with email or display name directly. Descriptor should be used here.
Thank you for your solution @xuzhang3, appreciate it. I'll close the ticket as it's been resolved.
Community Note
Terraform (and Azure DevOps Provider) Version
Terraform core version: 1.6.3 Provider version: 1.0.1
Affected Resource(s)
azuredevops_group_membership
Terraform Configuration Files
Debug Output
Actual Behavior
The deployment failed yielding the following error:
Error: Error adding group memberships during create: Error adding group memberships during update: Error adding member john.doe@contoso.com to group vssgp.Uy0xLTktMTU1MTM3NDI0NS0xNDgwMjgwMDg1LTEyMzE1NDQzOTYtMjI2NTc0NDI0NS0yNTc1MTkxMDY5LTEtMzQ0NzQ1MzMwMi0yNDE2NjE2MjY0LTIyNTY4NDEzOTEtNDA5MzAyNzk0Mw: The controller for path '/_apis/Graph/Memberships/john.doe@contoso.com/vssgp.Uy0xLTktMTU1MTM3NDI0NS0xNDgwMjgwMDg1LTEyMzE1NDQzOTYtMjI2NTc0NDI0NS0yNTc1MTkxMDY5LTEtMzQ0NzQ1MzMwMi0yNDE2NjE2MjY0LTIyNTY4NDEzOTEtNDA5MzAyNzk0Mw' was not found or does not implement IController.
Steps to Reproduce
Terraform plan and apply the code explained above to create a resource of type azuredevops_group_membership.
0000