Difference between revisions of "Terraform resource: aws wafv2 web acl"

From wikieduonline
Jump to navigation Jump to search
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
*<code>aws_wafv2_web_acl</code>
+
<code>aws_wafv2_web_acl</code> [https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/wafv2_web_acl link]
 +
 
 +
== Official example ==
 +
<pre>
 +
resource "aws_wafv2_web_acl" "example" {
 +
  name        = "managed-rule-example"
 +
  description = "Example of a managed rule."
 +
  scope      = "REGIONAL"
 +
 
 +
  default_action {
 +
    allow {}
 +
  }
 +
 
 +
  rule {
 +
    name    = "rule-1"
 +
    priority = 1
 +
 
 +
    override_action {
 +
      count {}
 +
    }
 +
 
 +
    statement {
 +
      managed_rule_group_statement {
 +
        name        = "AWSManagedRulesCommonRuleSet"
 +
        vendor_name = "AWS"
 +
 
 +
        rule_action_override {
 +
          action_to_use {
 +
            count {}
 +
          }
 +
 
 +
          name = "SizeRestrictions_QUERYSTRING"
 +
        }
 +
 
 +
        rule_action_override {
 +
          action_to_use {
 +
            count {}
 +
          }
 +
 
 +
          name = "NoUserAgent_HEADER"
 +
        }
 +
 
 +
        scope_down_statement {
 +
          geo_match_statement {
 +
            country_codes = ["US", "NL"]
 +
          }
 +
        }
 +
      }
 +
    }
 +
 
 +
    visibility_config {
 +
      cloudwatch_metrics_enabled = false
 +
      metric_name                = "friendly-rule-metric-name"
 +
      sampled_requests_enabled  = false
 +
    }
 +
  }
 +
 
 +
  tags = {
 +
    Tag1 = "Value1"
 +
    Tag2 = "Value2"
 +
  }
 +
 
 +
  token_domains = ["mywebsite.com", "myotherwebsite.com"]
 +
 
 +
  visibility_config {
 +
    cloudwatch_metrics_enabled = false
 +
    metric_name                = "friendly-metric-name"
 +
    sampled_requests_enabled  = false
 +
  }
 +
}
 +
</pre>
  
 
== Related terms ==
 
== Related terms ==
* [[AWS WAF]]
+
* [[AWS WAF]]: [[AWS WAF web ACLs|web ACLs]]
  
==See also==
+
== See also ==
*{{terraform aws resources}}
+
* {{aws wafv2}}
 +
* {{tf waf}}
  
 
[[Category:Terraform]]
 
[[Category:Terraform]]

Latest revision as of 11:19, 20 August 2024

aws_wafv2_web_acl link

Official example[edit]

resource "aws_wafv2_web_acl" "example" {
  name        = "managed-rule-example"
  description = "Example of a managed rule."
  scope       = "REGIONAL"

  default_action {
    allow {}
  }

  rule {
    name     = "rule-1"
    priority = 1

    override_action {
      count {}
    }

    statement {
      managed_rule_group_statement {
        name        = "AWSManagedRulesCommonRuleSet"
        vendor_name = "AWS"

        rule_action_override {
          action_to_use {
            count {}
          }

          name = "SizeRestrictions_QUERYSTRING"
        }

        rule_action_override {
          action_to_use {
            count {}
          }

          name = "NoUserAgent_HEADER"
        }

        scope_down_statement {
          geo_match_statement {
            country_codes = ["US", "NL"]
          }
        }
      }
    }

    visibility_config {
      cloudwatch_metrics_enabled = false
      metric_name                = "friendly-rule-metric-name"
      sampled_requests_enabled   = false
    }
  }

  tags = {
    Tag1 = "Value1"
    Tag2 = "Value2"
  }

  token_domains = ["mywebsite.com", "myotherwebsite.com"]

  visibility_config {
    cloudwatch_metrics_enabled = false
    metric_name                = "friendly-metric-name"
    sampled_requests_enabled   = false
  }
}

Related terms[edit]

See also[edit]

Advertising: