title: is there any way I associate aws ELB/ALB with WAF ACL using terraform?
body: <p>I created the following AWS WAF ACL and I want to associate it with my ALB using terraform. is there any way I can do it using terraform? 
  I want to block all requests except the ones that have secret key using amazon web service web application firewalls, aws waf.  For that purpose, I created byte_set, aws rule and access control lists, ACL </p>
  
  <pre><code>    resource "aws_alb" "app" {
      ............
    }
  
  
  #waf
  resource "aws_waf_byte_match_set" "byte_set" {
    name = "tf_waf_byte_match_set"
  
    byte_match_tuples {
      text_transformation   = "NONE"
      target_string         = "${var.secret_key}"
      positional_constraint = "EXACTLY"
  
      field_to_match {
        type = "HEADER"
        data = "referer"
      }
    }
  }
  
  resource "aws_waf_rule" "wafrule" {
    depends_on  = ["aws_waf_byte_match_set.byte_set"]
    name        = "tfWAFRule"
    metric_name = "tfWAFRule"
  
    predicates {
      data_id = "${aws_waf_byte_match_set.byte_set.id}"
      negated = false
      type    = "ByteMatch"
    }
  }
  
  resource "aws_waf_web_acl" "waf_acl" {
    depends_on  = ["aws_waf_byte_match_set.byte_set", "aws_waf_rule.wafrule"]
    name        = "tfWebACL"
    metric_name = "tfWebACL"
  
    default_action {
      type = "BLOCK"
    }
  
    rules {
      action {
        type = "ALLOW"
      }
  
      priority = 1
      rule_id  = "${aws_waf_rule.wafrule.id}"
    }
  }
  </code></pre>