-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
azurerm_role_assignment replaces unchanged role assignment #19847
Comments
Hi @DevopsMercenary , thanks for raising this issue. I could see the plan is not empty and showing force replacement. Does this happen when you first run terraform apply then rerun terraform plan or apply? |
I only ever run `terraform apply`. I’ve never tried it with a plan first. - Gregory BonkOn Jan 3, 2023, at 10:59 PM, Yun Liu ***@***.***> wrote:
Hi @DevopsMercenary , thanks for raising this issue. I could see the plan is not empty and showing force replacement. Does this happen when you first run terraform apply then rerun terraform plan or apply?
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
So this happens when you first run terraform apply? That is weird, force replacement usually happens when you changing an exsiting resource, but when running terraform apply for the first time, there should be no resource already exists. |
No, sorry. Only happens after the resource has been created. First |
It looks like
vs
Not sure if that is a bug, but can you try to modify your code like this and see if the update goes away? data "azurerm_subscription" "primary" {
}
data "azurerm_role_definition" "smb-contributor" {
name = "Storage File Data SMB Share Contributor"
scope = data.azurerm_subscription.primary.id # /subscriptions/00000000-0000-0000-0000-000000000000
}
# ... |
Another way to solve this is using |
Gave this a shot. Terraform still planned for replacement.... Code Update
Terraform's Replacement Plan
|
Sorry. Did that wrong. This does work. My Code change.
|
Yes. That does work. |
Great. A couple of options here. Any preference? Not a 'bug' ? |
Yeah, this is not a bug, even in the build-in test cases in this project, |
@liuwuliuyun Thanks for your help with this issue. @DevopsMercenary As this has been determined to not be a bug, I'm going to close this issue for now. If I have misunderstood and there is a bug to fix in the provider, please feel free to reply and we'll happily take another look. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Is there an existing issue for this?
Community Note
Terraform Version
1.3.6
AzureRM Provider Version
3.37.0
Affected Resource(s)/Data Source(s)
azurerm_role_assignment
Terraform Configuration Files
Debug Output/Panic Output
Expected Behaviour
I wouldn't expect the assignment to change just because the strings don't match exactly and one is just a substring of the other.
Actual Behaviour
The role assignment is needlessly replaced
Steps to Reproduce
terraform apply
Important Factoids
none
References
not that I know of
The text was updated successfully, but these errors were encountered: