Skip to content

aws_wafv2: Cannot generate logging definition with filter #34424

Closed
@hukm

Description

@hukm

Describe the bug

When defining logging for AWS WAF with filter according to documentation creation is failing with following error.

[#/LoggingFilter: extraneous key [defaultBehavior] is not permitted, #/LoggingFilter: extraneous key [filters] is not permitted]

My definition for logging configuration looks like this:

web_acl_log_config = wafv2.CfnLoggingConfiguration(
            self,
            f'MainInternetLoadBalancerWAFLoggingConfiguration-{stage}',
            log_destination_configs=[waf_log_group.log_group_arn],
            resource_arn=web_acl.attr_arn,
            logging_filter=wafv2.CfnLoggingConfiguration.LoggingFilterProperty(
                default_behavior="DROP",
                filters=[
                    wafv2.CfnLoggingConfiguration.FilterProperty(
                        requirement="MEETS_ANY",
                        behavior="KEEP",
                        conditions=[
                            wafv2.CfnLoggingConfiguration.ConditionProperty(
                                action_condition=wafv2.CfnLoggingConfiguration.ActionConditionProperty(
                                    action="COUNT"
                                )
                            ),
                            wafv2.CfnLoggingConfiguration.ConditionProperty(
                                action_condition=wafv2.CfnLoggingConfiguration.ActionConditionProperty(
                                    action="BLOCK"
                                )
                            ),
                            wafv2.CfnLoggingConfiguration.ConditionProperty(
                                action_condition=wafv2.CfnLoggingConfiguration.ActionConditionProperty(
                                    action="EXCLUDED_AS_COUNT"
                                )
                            ),
                        ]
                    )
                ]
            )
        )

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Library Version

No response

Expected Behavior

Resources creates with filter

Current Behavior

[#/LoggingFilter: extraneous key [defaultBehavior] is not permitted, #/LoggingFilter: extraneous key [filters] is not permitted]

Reproduction Steps

Included in description

Possible Solution

No response

Additional Information/Context

No response

AWS CDK Library version (aws-cdk-lib)

2.195.0

AWS CDK CLI version

2.1012.0

Node.js Version

20.18.0

OS

MacOS

Language

Python

Language Version

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions