https://pulumi.com logo
#general
Title
# general
d

damp-salesmen-74351

01/23/2024, 10:58 PM
I want to create a
waf
with rate limit rule, I try to create a
RuleGroup
but I got error for this line of code:
Copy code
action=pulumi_aws.wafv2.RuleGroupRuleActionArgs(
                    allow=pulumi_aws.wafv2.RuleGroupRuleActionAllowArgs(),
                ),
Here is the code:
Copy code
import pulumi
import pulumi_aws


def create_rate_limit_rule(
        deploy_name_prefix,
):
    """
    :param deploy_name_prefix:
    :return:
    """
    rate_based_rule = pulumi_aws.wafv2.RuleGroup(
        f'waf-rule-group{deploy_name_prefix}',
        capacity=100,
        scope="REGIONAL",
        rules=[
            pulumi_aws.wafv2.RuleGroupRuleArgs(
                name=f'waf-rule-group-arg{deploy_name_prefix}',
                priority=1,
                action=pulumi_aws.wafv2.RuleGroupRuleActionArgs(
                    allow=pulumi_aws.wafv2.RuleGroupRuleActionAllowArgs(),
                ),
                statement=pulumi_aws.wafv2.RuleGroupRuleStatementArgs(
                    rate_based_statement=pulumi_aws.wafv2.RuleGroupRuleStatementRateBasedStatementArgs(
                        aggregate_key_type="IP",
                        limit=100,
                    ),
                ),
                visibility_config=pulumi_aws.wafv2.RuleGroupRuleVisibilityConfigArgs(
                    cloudwatch_metrics_enabled=True,
                    metric_name='WafRbrMetric',
                    sampled_requests_enabled=True,
                ),
            )
        ],
        visibility_config=pulumi_aws.wafv2.RuleGroupVisibilityConfigArgs(
            cloudwatch_metrics_enabled=True,
            metric_name='WafRbrGroupMetric',
            sampled_requests_enabled=True,
        )
    )
    return rate_based_rule
Info:
Copy code
creating WAFv2 RuleGroup (waf-rule-group-pr-a12b7df): 
WAFInvalidParameterException: Error reason: The parameter value isn't supported., field: RULE_ACTION, parameter: AllowAction(customRequestHandling=null)
I successfully created but I always have diff update for it https://github.com/pulumi/pulumi-aws/issues/3306