-
Notifications
You must be signed in to change notification settings - Fork 1.8k
google_compute_security_policy rules are always recreated #16882
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
Comments
Seems like its happening only with newly created rules. I have a security policy which was created via the GCP console & has a total of 22 rules(again created via the GCP console), one of these rules was added relatively recently when compared to remaining 21. I am working on terraform import to construct the state of this security policy and I see that after import for this one particular rule, terraform always tries to delete the If I run To confirm my suspicion that this is been happening only with relatively new rules, I performed the below on the mentioned order:
Tried a couple of more times and repeatedly saw this issue occurring. When I create the policy & rules completely using terraform then I dont see this happening(Using module version v1.1.0). |
+1 |
There might be some slight overlap here #17288 |
To prevent my rules from being recreated each time, I had to specify these values in each rule that contained a preview = false
preconfigured_waf_config {} I also have a default rule with a Here are my versions:
(I am using the google-beta provider for my |
This bug makes managing cloud armor rules in terraform unusable, ie dangerous in production |
This didn't make any difference for me, I still see the rules being recreated. |
Edit: that didn't last long. Came back within a couple days. |
Facing the same problem.
These rules were initially created using terraform and rerunning terraform apply recreates them every time. |
Hi guys,
|
This issue is blocking GoogleCloudPlatform/terraform-google-cloud-armor#94 |
also experience the exact same issue ➕ 😢 terraform_version: 1.8.5
..
- Installed hashicorp/google v5.38.0 (signed by HashiCorp)
- Installing hashicorp/google-beta v5.38.0...
- Installed hashicorp/google-beta v5.38.0 (signed by HashiCorp) |
I have the same issue, I believe this is because the API to fetch the security policy returns the rules in an unsorted order, so I believe this method should fix it |
Suggested workaround while this is broken: Add a lifecycle ignore changes block to Define your rules using the Your rules will be defined by a different resource, and you will ignore the policy's desire to delete them |
I would use |
FYI we're using |
Hello there, I guess last PR fixes this issue, if that is so I guess we can close this. |
@maxi-cit It seems like it closed the issue with pre-configured_waf but issue with max. expr_options. recaptcha_options is still there. There is another issue open for both of the issues. It is resulting in recreation of the rules.
|
Hello everyone, I'm currently working on a fix for the issue with the One way I found to reproduce this permadiff state is to create the security policy and its rules via terraform, then manually set these empty |
Seeing this issue on our end too! |
Issue was resolved in [6.14].
Can you plz retry after upgrading provider? |
I still see |
@kameshraj can u plz add your notes in |
+1 |
@imrannayer I have updated my notes already here |
Community Note
modular-magician
user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned tohashibot
, a community member has claimed the issue already.Terraform Version
The same versions were also tested with amd64
Affected Resource(s)
Using resource through module
GoogleCloudPlatform/cloud-armor/google
version2.0.1
Expected Behavior
Terraform plan should be idempotent after terraform apply
Actual Behavior
Terraform always wants to recreate all rules in the security policy even if no changes are made and after applying and checking that all changes have been made.
Example of one rule:
References
#9084
The same issue as described and related issues
b/318850546
The text was updated successfully, but these errors were encountered: