google-cloud-platformgoogle-cloud-armorpulumi-typescript

How best to update a cloudarmor rule using pulumi


We're using pulumi to manage our cloudarmor (WAF) solution.

When attempting to edit a rule, even with deleteBeforeReplace: true, we get the error:

  CommandError: code: -2
   stdout: 
   stderr: Command failed with exit code 255: pulumi up --yes --skip-preview --diff --exec-agent pulumi/actions@v5 --color auto --suppress-outputs --suppress-progress --exec-kind auto.local --stack dev --non-interactive
  error:   sdk-v2/provider2.go:566: sdk.helper_schema: Error creating SecurityPolicyRule: googleapi: Error 400: Invalid value for field 'resource.priority': '6003'. Cannot have rules with the same priorities., invalid: provider=google-beta@8.31.0
  
  error: 1 error occurred:
    * Error creating SecurityPolicyRule: googleapi: Error 400: Invalid value for field 'resource.priority': '6003'. Cannot have rules with the same priorities., invalid

The only path forward seems to be to:

Is there a better way? (other than juggling rule .priority values?)

EDIT: Updated initial post's process from delete/up/create/up

NOTE: when faced with a deletion+creation, default behaviour seems to be for Pulumi to create new resources before deleting the existing ones; at least there's no gap in coverage.


Solution

  • So a few observations:

    So in the end, the best solution seems to be the one above: