-
Notifications
You must be signed in to change notification settings - Fork 304
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
(reopen #1402) azuread_application_app_role always either deletes / recreates the role on each apply #1411
Comments
You need to add the resource "azuread_application" "appreg" {
display_name = "test123"
lifecycle {
ignore_changes = [
app_role,
]
}
}
resource "azuread_application_app_role" "role1" {
application_id = azuread_application.appreg.id
role_id = "6bd5554f-a935-4e9f-9223-c87a64c22fba"
allowed_member_types = ["User"]
description = "desc"
display_name = "displayname"
value = "123"
} Ref: https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/resources/application_app_role |
Hi @nbaju1 - thanks very much and I can confirm that works. I had read the documentation but assumed it meant if there was a conflicting block 'app_roles' in the app reg definition and an app roles resource it would need the ignore_changes so that's my mistake and thanks for the solution. Any ideas why it works this way?? In AzureRM if I create vnet resource and a subnet resource I do not have to 'ignore_changes' for the subnets in the vnet configuration... Something specific to AzureAD and graph? |
@AlexcFrench In both the AzureRM and AzureAD providers, due to upstream changes in Terraform over time, we are phasing out the use of so-called "optional & computed" properties -this is the mechanism by which we have historically masked these diffs. Existing implementations of this will be removed as we release new major versions of the each provider, whilst we are intentionally avoiding adding new implementations of this. Going forward, particularly in the next major releases of each provider, it will be necessary to use |
Thanks @manicminer I was not aware of this but it's very useful and we can start future proofing now. Thanks for all your great work chaps :-) |
Community Note
Terraform (and AzureAD Provider) Version
Terraform v1.8.5
on windows_amd64
Affected Resource(s)
azuread_application_app_role
azuread_XXXXX
Terraform Configuration Files
Debug Output
Panic Output
Expected Behavior
once applied there should be no changes required on subsequent plan/apply runs
Actual Behavior
a tf plan / apply creates the role
Another plan / apply deletes the role
Another plan / apply recreates the role
No code changes at any point
Steps to Reproduce
tf init
tf plan
tf apply
tf plan
tf apply
Important Factoids
was opened initially as #1402, related to #1344 but #1344 was closed last week as part of #1403.
I've used 2.52.0 but the problem still exists
References
The text was updated successfully, but these errors were encountered: