aws-cdk: wafv2: add_override does not obey Action key

Describe the bug

Trying to add a rule to an specific key breaks as Action is not added:

waf_acl = wafv2.CfnWebACL(self, 'id', **params)
# Assuming above we would have only one rule
new_rule = {
    "Action": {
        "Block": {}
    },
    "Name": "Deny_regex",
    "Priority": 1,
    "Statement": {
        "RegexPatternSetReferenceStatement": {
            "Arn": {
                "Fn::ImportValue": "my-regex-arn"
            },
            "FieldToMatch": {
                "SingleHeader": {
                    "Name": "my-header"
                }
            },
            "TextTransformations": [
                {
                    "Priority": 0,
                    "Type": "NONE"
                }
            ]
        }
    },
    "VisibilityConfig": {
        "CloudWatchMetricsEnabled": True,
        "MetricName": "Deny_regex",
        "SampledRequestsEnabled": True
    }
}
waf_acl.add_override('Properties.Rules.1', new_rule)

At the final template, the Action block is not present:

{
    "Name": "Deny_regex",
    "Priority": 1,
    "Statement": {
        "RegexPatternSetReferenceStatement": {
            "Arn": {
                "Fn::ImportValue": "my-regex-arn"
            },
            "FieldToMatch": {
                "SingleHeader": {
                    "Name": "my-header"
                }
            },
            "TextTransformations": [
                {
                    "Priority": 0,
                    "Type": "NONE"
                }
            ]
        }
    },
    "VisibilityConfig": {
        "CloudWatchMetricsEnabled": true,
        "MetricName": "Deny_regex",
        "SampledRequestsEnabled": true
    }
}

Expected Behavior

Expected the rule json output to have the Action block

Current Behavior

Somehow, the Action json block is not being added to the final template

Reproduction Steps

Create a waf, and try to use add_override with a plain json rule on wafv2

Possible Solution

Add Action to the jsii interface mappings? Somehow Action is missing.

Additional Information/Context

No response

CDK CLI Version

2.127.0 (build 6c90efc)

Framework Version

No response

Node.js Version

v18.17.0

OS

MacOs

Language

Python

Language Version

Python 3.9.6

Other information

No response

About this issue

  • Original URL
  • State: open
  • Created 4 months ago
  • Reactions: 2
  • Comments: 15 (8 by maintainers)

Most upvoted comments

Hey @Rondineli, please go ahead with re-working your PR and thank you for picking this up. 😃