-
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
Policies always update even when no change occurs #5014
Comments
I had the same issue and work around is adding below section in the policy definition. Hope it works for you. ========== lifecycle { |
Similar issue as #3500 |
While the proposed work around solves this issue, it has one con in that other changes to metadata will be ignored as well. Would be better if you could specify specific attributes to ignore on metadata
However this is not currently supported. Error: Invalid index on modules/allowed-locations/main.tf line 15, in resource "azurerm_policy_definition" "allowed-locations": This value does not have any indices. According to the documentation on lifecycle management this should be supported. https://www.terraform.io/docs/configuration/resources.html#lifecycle-lifecycle-customizations |
I have confirmed that this issue still exists in provider.azurerm = 2.4.0 |
I think I have a fix for this. I'll create a PR and mention this issue in it. |
The pull request only address the issue in azurerm_policy_set_definition resources . Can you make the change for azurerm_policy_definition resources as well ? |
I don't know why I thought it only affected policy initiatives. I need to create a test for the PR anyway, so yes, I'll modify azurerm_policy_definition too. My first ever code change, so this is a definite learning experience! |
Custom metadata DiffSuppressFunc - issue #5014
This has been released in version 2.9.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example: provider "azurerm" {
version = "~> 2.9.0"
}
# ... other configuration ... |
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. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks! |
Related to #2938
Terraform (and AzureRM Provider) Version
Affected Resource(s)
azurerm_policy_definition
Terraform Configuration Files
Expected Behavior
Terraform should report no updates in policies that haven't changed during
terraform apply
andterraform plan
Actual Behavior
Terraform always update on refresh, policies that haven't changed.
What Terraform is updating though, are fields in Metadata that are not present in the configuration file, but are present in Azure, so it tries to clear them.
Steps to Reproduce
terraform apply
terraform plan
Important Factoids
This policy has been created within the same configuration file, using the same state file.
The text was updated successfully, but these errors were encountered: