Skip to content

Commit a14fff7

Browse files
authored
Merge pull request #3 from Samseppiol/master
Allow modification of default action via config file value
2 parents ae0a307 + 2c67be8 commit a14fff7

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

tests/iplists.test.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ test_metadata:
33
name: iplists
44
description: IP white and black lists
55

6+
default_block: true
7+
68
ipsets:
79
WhitelistOne:
810
desc: ips to whitelist for my waf

wafv2.cfndsl.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@
8080
end
8181
end
8282

83+
default_block = external_parameters.fetch(:default_block, false)
84+
8385
WAFv2_WebACL(:WAF) {
8486
Name FnSub("${EnvironmentName}-#{component_name}")
8587
Description FnSub("#{component_name}")
@@ -89,9 +91,7 @@
8991
CloudWatchMetricsEnabled: cloudwatch['enabled'],
9092
MetricName: FnSub("#{cloudwatch['metric_name_prefix']}WAFWebACL")
9193
})
92-
DefaultAction({
93-
Allow: {}
94-
})
94+
DefaultAction default_block ? ({Block: {}}) : ({Allow: {}})
9595
Rules(waf_rules)
9696
}
9797

0 commit comments

Comments
 (0)