我当前正在使用版本0.11编写Terraform脚本,并且如果存在“ HEADER”,则需要使用插值将数据值添加为“ cookie”。我正在努力进行这项工作,因为我显然不明白问题所在。
resource "aws_wafregional_sql_injection_match_set" "sql_injection_match_set" {
name = "${var.application_name}_owasp10_sqlinjection"
count = "${length(var.sql_injection_match_tuple_field_to_match_types)}"
sql_injection_match_tuple {
text_transformation = "URL_DECODE"
field_to_match {
type = "${element(var.sql_injection_match_tuple_field_to_match_types, count.index)}"
**data =**
}
}
sql_injection_match_tuple {
text_transformation = "HTML_ENTITY_DECODE"
field_to_match {
type = "${element(var.sql_injection_match_tuple_field_to_match_types, count.index)}"
**data =**
}
}
}
resource "aws_wafregional_rule" "sql_injection_match_set_rule" {
name = "${var.application_name}_sql_injection"
metric_name = "${var.application_name}${var.sql_injection_metric_name}"
predicate {
type = "SqlInjectionMatch"
data_id = "${aws_wafregional_sql_injection_match_set.sql_injection_match_set.*.id}"
negated = false
}
}
以上内容适合为WAF规则创建的更大模块,并将其附加到所使用的ALB。粗体部分目前为空白,因为无论我尝试什么,它似乎都无法正常工作。它调用的变量包含四种类型,一种是HEADER。