Skip to content

Commit 1f17f91

Browse files
author
olamide
committed
Add waf rule to inspect for header values
1 parent 295df88 commit 1f17f91

File tree

2 files changed

+32
-7
lines changed

2 files changed

+32
-7
lines changed

aws/waf/jang/main.tf

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
variable "header_match_rules" {
2+
description = "Rule statement to inspect and match the header for an incoming request."
3+
type = map(object({
4+
name = string # Name of the header match rule group
5+
priority = number # Relative processing order for header match rule relative to other rules processed by AWS WAF.
6+
header_name = string # This is the name of the header to inspect for all incoming requests.
7+
header_value = string # This is the value to look out for a matching header name for all incoming requests
8+
count_override = optional(bool, true) # If true, this will override the rule action setting to `count`, if false, the rule action will be set to `block`. Default value is false.
9+
country_list = optional(list(string), []) # List of countries to apply the header match to. If populated, from other countries will be ignored by this rule. IF empty, the rule will apply to all traffic. You must either specify country_list or exempt_country_list, but not both.
10+
exempt_country_list = optional(list(string), []) # List of countries to exempt from the header match rule. If populated, the selected countries will be ignored by this rule. IF empty, the rule will apply to all traffic. You must either specify country_list or exempt_country_list, but not both.
11+
}))
12+
13+
# default = {
14+
# "default-header-rule" = {
15+
16+
# }
17+
# }
18+
default = null
19+
}
20+
21+
output "name" {
22+
value = var.header_match_rules
23+
}

aws/waf/variables.tf

+9-7
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,16 @@ variable "rate_limit_rules" {
4646
variable "header_match_rules" {
4747
description = "Rule statement to inspect and match the header for an incoming request."
4848
type = map(object({
49-
name = optional(string, "default-header-rule") # Name of the header match rule group
50-
priority = optional(number, 99) # Relative processing order for header match rule relative to other rules processed by AWS WAF.
51-
header_name = optional(string, "null") # This is the name of the header to inspect for all incoming requests.
52-
header_value = optional(string, "null") # This is the value to look out for a matching header name for all incoming requests
53-
count_override = optional(bool, true) # If true, this will override the rule action setting to `count`, if false, the rule action will be set to `block`. Default value is false.
54-
country_list = optional(list(string), []) # List of countries to apply the header match to. If populated, from other countries will be ignored by this rule. IF empty, the rule will apply to all traffic. You must either specify country_list or exempt_country_list, but not both.
55-
exempt_country_list = optional(list(string), []) # List of countries to exempt from the header match rule. If populated, the selected countries will be ignored by this rule. IF empty, the rule will apply to all traffic. You must either specify country_list or exempt_country_list, but not both.
49+
name = string # Name of the header match rule group
50+
priority = number # Relative processing order for header match rule relative to other rules processed by AWS WAF.
51+
header_name = string # This is the name of the header to inspect for all incoming requests.
52+
header_value = string # This is the value to look out for a matching header name for all incoming requests
53+
count_override = optional(bool, true) # If true, this will override the rule action setting to `count`, if false, the rule action will be set to `block`. Default value is false.
54+
country_list = optional(list(string), []) # List of countries to apply the header match to. If populated, from other countries will be ignored by this rule. IF empty, the rule will apply to all traffic. You must either specify country_list or exempt_country_list, but not both.
55+
exempt_country_list = optional(list(string), []) # List of countries to exempt from the header match rule. If populated, the selected countries will be ignored by this rule. IF empty, the rule will apply to all traffic. You must either specify country_list or exempt_country_list, but not both.
5656
}))
57+
58+
default = null
5759
}
5860

5961
variable "allowed_ip_list" {

0 commit comments

Comments
 (0)