Open mikhailshilkov opened 3 years ago
I used a workaround by adding a random string at the end of the name before creating the security policy. So every deployment creates a new policy and deletes the old.
@sghosh-discovery thank you for confirming the workaround. Our most likely short-term fix will do the same automatically.
Any status on this issues? Having the same issue.
Using random names for the policy - is not an option - When you combine it with GKE + Ingress resource. (Or it makes it really hard - at least).
An alternative to adding a random string is to use replaceOnChanges
(see https://www.pulumi.com/blog/pulumi-release-notes-m58/#new-replaceonchanges-resource-option)
replaceOnChanges
will not work though if the Cloud Armor policy is already in used. It will throw below error. Removing the resource (e.g. GKE Ingress Load Balancers) from Cloud Armor policy might not be an ideal solution especially if you have this already in production environment. Does anyone have other approach in updating Cloud Armor policy if it's already in used?
operation errored with map[errors:[map[code:RESOURCE_IN_USE_BY_ANOTHER_RESOURCE message:The security_policy resource 'projects/demo-app-qa/global/securityPolicies/demo-qa-cloudarmor-allow-policy-classic-de44ca2' is already being used by 'projects/demo-app-qa/global/backendServices/k8s-be-32448--b027567ac73d16b6']]]
@marvmariano you need to manually remove the previous policy on your cloud armor instance and run the policy again. Or fall back to the Classic provider (which does not have this issue occurring).
I also had the the same error occur in my instance which appears to be due to this same issue.
@marvmariano you need to manually remove the previous policy on your cloud armor instance and run the policy again. Or fall back to the Classic provider (which does not have this issue occurring).
I also had the the same error occur in my instance which appears to be due to this same issue.
Yeah, I've tested in Classic as well and no issue with that. That will be the solution for now. With native, removing the previous policy or the target (if in used) is not ideal solution if you already running in production especially in highly-regulated environment.
We wanted to update the IP whitelisting range for the cloud armor. However, any update of rules fails.
For example, see the code:
If you add more IP ranges in the array ipRanges, an update fails.
Steps to reproduce
Expected: Update succeeds.
Actual: