8000 Changing display name of azuread_group resource for security groups causes terraform plan to fail · Issue #1634 · hashicorp/terraform-provider-azuread · GitHub
[go: up one dir, main page]

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

Changing display name of azuread_group resource for security groups causes terraform plan to fail #1634

Open
smarshie opened this issue Feb 3, 2025 · 0 comments

Comments

@smarshie
Copy link
smarshie commented Feb 3, 2025

Community Note

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

Terraform (and AzureAD Provider) Version

AzureAD provider versions: Checked with both 3.0.2 and 3.1.0. Same result for both, regardless of version original group was created with.

Terraform version: 1.8.1.
(But given the nature of the error message and the fact that there is no such problem with M365 groups, I don't think this is relevant.)

Affected Resource(s)

  • azuread_group

Terraform Configuration Files

Config for creating the group:

data "azuread_client_config" "current" {}

resource "azuread_group" "security_test" {

  display_name            = "Terraform bug test - Original group name"
  description             = "Some description"
  security_enabled        = true
  mail_enabled            = false
  mail_nickname           = "test_group_bug"
  assignable_to_role      = false
  owners                  = [data.azuread_client_config.current.object_id]
  prevent_duplicate_names = true

}

Config with display name changed:

data "azuread_client_config" "current" {}

resource "azuread_group" "security_test" {

  display_name            = "Terraform bug test - New group name"
  description             = "Some description"
  security_enabled        = true
  mail_enabled            = false
  mail_nickname           = "test_group_bug"
  assignable_to_role      = false
  owners                  = [data.azuread_client_config.current.object_id]
  prevent_duplicate_names = true

}

Debug Output

https://gist.github.com/smarshie/b2c9286c8208b762208aa2fe137e423b

Panic Output

N/A

Expected Behavior

Display name of security group should be changed without recreating the resource.

Actual Behavior

Terraform plan fails with error message which clearly indicates that display name is being used to search for the existing group rather than an immutable id such as the group id or the mail nickname

Planning failed. Terraform encountered an error while generating this plan.

Error: could not check for existing group(s): unable to list Groups with filter "displayName eq 'Terraform bug test - New group name'": the context used must have a deadline attached for polling purposes, but got no deadline

with azuread_group.security_test,
on main.tf line 3, in resource "azuread_group" "security_test":
3: resource "azuread_group" "security_test" {

Steps to Reproduce

  1. 'terraform plan'
  2. 'terraform apply'
  3. Change display name in the configuration
  4. 'terraform plan'

Important Factoids

For M365 groups, renaming is successful and this problem is not observed.

References

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

No branches or pull requests

1 participant
0