-
Notifications
You must be signed in to change notification settings - Fork 301
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
Entra ID Group constantly gets removed/added to an Administrative Unit each time Terraform runs #1336
Comments
Do you experience the same issue if you reference the object IDs directly? I.e. resource "azuread_administrative_unit_member" "example" {
administrative_unit_object_id = azuread_administrative_unit.example.object_id
member_object_id = azuread_group.example.object_id
} |
it's the same issue using |
Hi @matthorgan, thanks for opening this issue. This is actually expected behavior due to the resource "azuread_administrative_unit" "example" {
display_name = "Example-AU"
}
resource "azuread_group" "example" {
display_name = "Example Users"
security_enabled = true
lifecycle {
ignore_changes = [administrative_unit_ids]
}
}
resource "azuread_administrative_unit_member" "example" {
administrative_unit_object_id = azuread_administrative_unit.example.id
member_object_id = azuread_group.example.id
} However, I noticed that we don't call this out specifically in the documentation for either resource, so I will open a PR to fix that. |
Community Note
Terraform (and AzureAD Provider) Version
Affected Resource(s)
azuread_administrative_unit_member
Terraform Configuration Files
Debug Output
https://gist.github.com/matthorgan/a09b9aed9c0b1ac145c58f362791544a
Expected Behavior
Entra ID group gets added to the Administrative Unit and on subsequent runs, no changes are expected.
Actual Behavior
The Entra ID group gets added to the Administrative Unit, but on the next run, it gets removed and this add/remove behaviour continues on each run.
Steps to Reproduce
terraform apply
Important Factoids
This issue does not happen if you add a User to the Administrative Unit using
azuread_administrative_unit_member
. It seems specific to theazuread_group
resource.In the debug logs it looks like it's using the
beta
API. Could this be an issue? It looks like AUs have functionality in the v1 of the apiI've noticed that the state refresh for the
azuread_administrative_unit_member.example
resource can take upwards of a minute.References
https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/resources/administrative_unit_member
The text was updated successfully, but these errors were encountered: