-
Notifications
You must be signed in to change notification settings - Fork 308
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
[BUG] Group naming policy is not respected for 365 groups #1556
Comments
For reference, seems this behavior was introduced in #659 (cc @manicminer) |
@tibbing That's an unfortunate side effect of the way the provider attempts to manage eventual consistency in the API. For context, groups are patched with a temporary display name in order to determine whether the group has successfully replicated on the backend. It's possible a different field could be used here that is less likely to fall foul of a policy setting. Unfortunately the group description can't be used here as there is a separate bug that would break this when created unified groups. EDIT: At second glance, I don't see any other field that would be suitable for this. More thought needed here. |
FWIW we've been running the forked provider (without the eventual consistency logic) for a couple of months with quite heavy usage now without any issues whatsoever. Might have been lucky so far, but do we know for sure that eventual consistency really needs to be considered here? If yes, couldn't we add prefix/suffix arguments (or a policy regex) that isused with the temporary name so that we still comply with the naming policy? |
@tibbing It's definitely an issue, one that surfaces pretty quickly across the provider user base. The backend replication of new groups is not very predictable, but anecdotally seems to be subject to a number of factors including number of objects in tenant, number of groups in tenant, number of members in groups, tenant geo location, API operations across the tenant per time period, API operations per principal per time period, and general Azure AD (Entra ID) system status. The current workaround by the provider of temporarily patching the display name was arrived at after extensive testing and user reports - unfortunately Microsoft Graph doesn't offer a reliable way of determining the replication status of a group (or any object), and read-consistent caching compounds this; hence the PATCH operation. It could get very complicated trying to construct a temporary name that meets the naming policy, given the relatively short maxlength and wide range of group names being attempted in the wild (not to mention complexity/constraints of naming policies). I do think a better solution is warranted, I am just not yet sure what that should be. |
Community Note
Terraform (and AzureAD Provider) Version
Affected Resource(s)
azuread_group
Terraform Configuration Files
Debug Output
Debug log excerpt
Expected Behavior
The newly created group is either not renamed, or the temporary name respects the naming policy. Perhaps there could be an argument for prefix/suffix in the module. Can we determine if the group exists by objectId rather than renaming it?
Actual Behavior
The group is temporarily renamed to
TERRAFORM_UPDATE_%s
here. This will fail if there is a naming policy configured with error:The property is missing a required prefix/suffix per your organization's Group naming requirements.
Steps to Reproduce
terraform apply
References
terraform-provider-azuread/internal/services/groups/group_resource.go
Line 721 in 51bd998
The text was updated successfully, but these errors were encountered: