Skip to main content

rule_groups

Creates, updates, deletes or gets a rule_group resource or lists rule_groups in a region

Overview

Namerule_groups
TypeResource
DescriptionContains the Rules that identify the requests that you want to allow, block, or count. In a RuleGroup, you also specify a default action (ALLOW or BLOCK), and the action for each Rule that you add to a RuleGroup, for example, block requests from specified IP addresses or block requests from specified referrers. You also associate the RuleGroup with a CloudFront distribution to identify the requests that you want AWS WAF to filter. If you add more than one Rule to a RuleGroup, a request needs to match only one of the specifications to be allowed, blocked, or counted.
Idawscc.wafv2.rule_groups

Fields

NameDatatypeDescription
arnstring
capacityinteger
descriptionstringDescription of the entity.
namestringName of the WebACL.
idstringId of the WebACL
scopestringUse CLOUDFRONT for CloudFront WebACL, use REGIONAL for Application Load Balancer and API Gateway.
rulesarrayCollection of Rules.
visibility_configobjectVisibility Metric of the WebACL.
tagsarray
label_namespacestringName of the Label.
custom_response_bodiesobjectCustom response key and body map.
available_labelsarrayCollection of Available Labels.
consumed_labelsarrayCollection of Consumed Labels.
regionstringAWS region.

For more information, see AWS::WAFv2::RuleGroup.

Methods

NameResourceAccessible byRequired Params
create_resourcerule_groupsINSERTCapacity, Scope, VisibilityConfig, region
delete_resourcerule_groupsDELETEIdentifier, region
update_resourcerule_groupsUPDATEIdentifier, PatchDocument, region
list_resourcesrule_groups_list_onlySELECTregion
get_resourcerule_groupsSELECTIdentifier, region

SELECT examples

Gets all properties from an individual rule_group.

SELECT
region,
arn,
capacity,
description,
name,
id,
scope,
rules,
visibility_config,
tags,
label_namespace,
custom_response_bodies,
available_labels,
consumed_labels
FROM awscc.wafv2.rule_groups
WHERE
region = '{{ region }}' AND
Identifier = '{{ name }}|{{ id }}|{{ scope }}';

INSERT example

Use the following StackQL query and manifest file to create a new rule_group resource, using stack-deploy.

/*+ create */
INSERT INTO awscc.wafv2.rule_groups (
Capacity,
Scope,
VisibilityConfig,
region
)
SELECT
'{{ capacity }}',
'{{ scope }}',
'{{ visibility_config }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

UPDATE example

Use the following StackQL query and manifest file to update a rule_group resource, using stack-deploy.

/*+ update */
UPDATE awscc.wafv2.rule_groups
SET PatchDocument = string('{{ {
"Capacity": capacity,
"Description": description,
"Rules": rules,
"VisibilityConfig": visibility_config,
"Tags": tags,
"CustomResponseBodies": custom_response_bodies
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ name }}|{{ id }}|{{ scope }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

DELETE example

/*+ delete */
DELETE FROM awscc.wafv2.rule_groups
WHERE
Identifier = '{{ name }}|{{ id }}|{{ scope }}' AND
region = '{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

Additional Parameters

Mutable resources in the Cloud Control provider support additional optional parameters which can be supplied with INSERT, UPDATE, or DELETE operations. These include:

ParameterDescription
ClientToken
A unique identifier to ensure the idempotency of the resource request.This allows the provider to accurately distinguish between retries and new requests.
A client token is valid for 36 hours once used.
After that, a resource request with the same client token is treated as a new request.
If you do not specify a client token, one is generated for inclusion in the request.
RoleArn
The ARN of the IAM role used to perform this resource operation.The role specified must have the permissions required for this operation.
If you do not specify a role, a temporary session is created using your AWS user credentials.
TypeVersionId
For private resource types, the type version to use in this resource operation.If you do not specify a resource version, the default version is used.

Permissions

To operate on the rule_groups resource, the following permissions are required:

wafv2:CreateRuleGroup,
wafv2:GetRuleGroup,
wafv2:TagResource,
wafv2:UntagResource,
wafv2:ListTagsForResource