hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.82k stars 9.16k forks source link

WAF v2 and_statement #21052

Closed Arisfx closed 3 years ago

Arisfx commented 3 years ago

Hi all, i am trying to use the and_statement to combine different statements (we need to combine ip filtering with url).

The issue is that from the documentation is not clear if the and_statement block should include inside it the statement argument, or the opposite, the statement block should include inside it the and_statement argument:

I tried several ways of composing the code, can please someone tell me what i am doing wrong?

resource “aws_wafv2_web_acl” “alb_waf” {
name = “ALB-WAF”
description = “ALB”
scope = “REGIONAL”

default_action {
block {}
}

rule {
name = “allow-specific-ips”
priority = 1

action {
  allow {}
}
statement {
  and_statement {
    ip_set_reference_statement {
      arn = aws_wafv2_ip_set.ipset.arn
    }
    regex_pattern_set_reference_statement {
      arn = aws_wafv2_regex_pattern_set.staging_regex.arn
    }
  } # and_statement
} # statement block

error code

Error: Unsupported block type

on main.tf line 56, in resource “aws_wafv2_web_acl” “alb_waf”:
56: regex_pattern_set_reference_statement {

Blocks of type “regex_pattern_set_reference_statement” are not expected here.
github-actions[bot] commented 2 years ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.