我创建了以下 AWS WAF ACL,我想使用 terraform 将它与我的 ALB 相关联。有什么办法可以使用 terraform 做到这一点吗?我想使用亚马逊 Web 服务 Web 应用程序防火墙 aws waf 阻止除具有密钥的请求之外的所有请求。为此,我创建了 byte_set、aws 规则和访问控制列表、ACL
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"
} …Run Code Online (Sandbox Code Playgroud)