AWS WAF Size Constraint Set

This page shows how to write Terraform and CloudFormation for AWS WAF Size Constraint Set and write them securely.

aws_waf_size_constraint_set (Terraform)

The Size Constraint Set in AWS WAF can be configured in Terraform with the resource name aws_waf_size_constraint_set. The following sections describe 2 examples of how to use the resource and its parameters.

Example Usage from GitHub

main.tf#L2
resource "aws_waf_size_constraint_set" "main" {
  name = var.name

  size_constraints {
    text_transformation = var.text_transformation
    comparison_operator = var.comparison_operator
main.tf#L7
resource "aws_waf_size_constraint_set" "this" {
  name = var.name

  dynamic "size_constraints" {
    for_each = var.size_constraints
    content {

Review your Terraform file for AWS best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Provides a WAF Size Constraint Set Resource

AWS::WAF::SizeConstraintSet (CloudFormation)

The SizeConstraintSet in WAF can be configured in CloudFormation with the resource name AWS::WAF::SizeConstraintSet. The following sections describe 10 examples of how to use the resource and its parameters.

Example Usage from GitHub

owasp_10_base.yml#L773
    Type: AWS::WAF::SizeConstraintSet
    Condition: isGlobal
    Properties:
      Name: !Join ['-', [!Ref stackPrefix, 'size-restrictions']]
      SizeConstraints:
        - FieldToMatch:
owasp_10_base.yml#L771
    Type: AWS::WAF::SizeConstraintSet
    Condition: isGlobal
    Properties:
      Name: !Join ['-', [!Ref stackPrefix, 'size-restrictions']]
      SizeConstraints:
        - FieldToMatch:
owasptop10.yml#L538
    Type: AWS::WAF::SizeConstraintSet
    Condition: isGlobal
    Properties:
      Name: !Join ['-', [!Ref stackPrefix, 'size-restrictions']]
      SizeConstraints:
        - FieldToMatch:
waf-udagram.yml#L117
    Type: 'AWS::WAF::SizeConstraintSet'
  SqliMatchSet:
    Properties:
      Name: !Join
        - ''
        - - !Ref WebAppACL
waf.yml#L115
    Type: 'AWS::WAF::SizeConstraintSet'
  SqliMatchSet:
    Properties:
      Name: !Join
        - ''
        - - !Ref WebAppACL
cfn_waf-size_1_v1.json#L32
      "Type": "AWS::WAF::SizeConstraintSet",
      "Properties": {
        "Name": {
          "Ref": "SizeCondition1"
        },
        "SizeConstraints": [
WAFSizeConstraintSetSpecification.json#L3
    "AWS::WAF::SizeConstraintSet.FieldToMatch": {
      "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-sizeconstraintset-sizeconstraint-fieldtomatch.html",
      "Properties": {
        "Data": {
          "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-sizeconstraintset-sizeconstraint-fieldtomatch.html#cfn-waf-sizeconstraintset-sizeconstraint-fieldtomatch-data",
          "PrimitiveType": "String",
WAFSizeConstraintSetSpecification.json#L3
    "AWS::WAF::SizeConstraintSet.FieldToMatch": {
      "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-sizeconstraintset-sizeconstraint-fieldtomatch.html",
      "Properties": {
        "Data": {
          "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-sizeconstraintset-sizeconstraint-fieldtomatch.html#cfn-waf-sizeconstraintset-sizeconstraint-fieldtomatch-data",
          "PrimitiveType": "String",
WAFSizeConstraintSetSpecification.json#L3
    "AWS::WAF::SizeConstraintSet.FieldToMatch": {
      "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-sizeconstraintset-sizeconstraint-fieldtomatch.html",
      "Properties": {
        "Data": {
          "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waf-sizeconstraintset-sizeconstraint-fieldtomatch.html#cfn-waf-sizeconstraintset-sizeconstraint-fieldtomatch-data",
          "PrimitiveType": "String",
WAF.json#L111
  "resourceType" : "AWS::WAF::SizeConstraintSet",
  "properties" : [ {
    "propertyName" : "Name",
    "propertyType" : "String",
    "required" : true
  }, {

Parameters

Explanation in CloudFormation Registry

Note This is AWS WAF Classic documentation. For more information, see AWS WAF Classic in the developer guide. For the latest version of AWS WAF , use the AWS WAFV2 API and see the AWS WAF Developer Guide. With the latest version, AWS WAF has a single set of endpoints for regional and global use. A complex type that contains SizeConstraint objects, which specify the parts of web requests that you want AWS WAF to inspect the size of. If a SizeConstraintSet contains more than one SizeConstraint object, a request only needs to match one constraint to be considered a match.

Frequently asked questions

What is AWS WAF Size Constraint Set?

AWS WAF Size Constraint Set is a resource for WAF of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS WAF Size Constraint Set?

For Terraform, the boldlink/terraform and niveklabs/aws source code examples are useful. See the Terraform Example section for further details.

For CloudFormation, the Amish132/Cloud-AWS--Fault-Tolerant-Notes-Application, gaurangdavda/CloudNote and TeliaSoneraNorge/telia-terraform-modules source code examples are useful. See the CloudFormation Example section for further details.