File tree Expand file tree Collapse file tree 3 files changed +33
-2
lines changed Expand file tree Collapse file tree 3 files changed +33
-2
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,12 @@ module "managed_rules" {
13
13
" Operational-Best-Practices-for-NIST-800-53-rev-4" ,
14
14
]
15
15
16
+ rule_packs_to_exclude = [
17
+ " Operational-Best-Practices-for-CIS-AWS-v1.4-Level1" ,
18
+ " Operational-Best-Practices-for-CIS-AWS-v1.4-Level2" ,
19
+ ]
20
+
21
+
16
22
# Extra rules not included in the Packs you want to deploy
17
23
rules_to_include = [
18
24
" dax-encryption-enabled" ,
@@ -35,4 +41,4 @@ module "managed_rules" {
35
41
}
36
42
}
37
43
}
38
- }
44
+ }
Original file line number Diff line number Diff line change @@ -6,6 +6,11 @@ locals {
6
6
local . pack_file [" packs" ][pack ]
7
7
]
8
8
9
+ rule_packs_to_exclude = [
10
+ for pack in var . rule_packs_to_exclude :
11
+ local . pack_file [" packs" ][pack ]
12
+ ]
13
+
9
14
rules_collected = sort (
10
15
distinct (
11
16
flatten (
@@ -17,9 +22,20 @@ locals {
17
22
)
18
23
)
19
24
25
+ rules_exclude_collected = sort (
26
+ distinct (
27
+ flatten (
28
+ concat (
29
+ var. rules_to_exclude ,
30
+ local. rule_packs_to_exclude
31
+ )
32
+ )
33
+ )
34
+ )
35
+
20
36
final_rules = [
21
37
for rule in local . rules_collected :
22
- rule if ! contains (var . rules_to_exclude , rule)
38
+ rule if ! contains (local . rules_exclude_collected , rule)
23
39
]
24
40
25
41
final_managed_rules = merge (local. managed_rules , var. rule_overrides )
Original file line number Diff line number Diff line change @@ -19,6 +19,15 @@ variable "rule_packs" {
19
19
type = list (string )
20
20
}
21
21
22
+ # In cases where rules from other packs overlap and let's say we want to exclude all overlap rules from a pack..
23
+ # this feature should address that. Example use case is where securityhub deploys CIS Level1 and 2 Rules and
24
+ # lets say we want to exclude all these rules from NIST pack
25
+ variable "rule_packs_to_exclude" {
26
+ description = " A list of Rule Packs (based off AWS Conformance Packs) from which overlap rules to exclude"
27
+ default = []
28
+ type = list (string )
29
+ }
30
+
22
31
variable "rules_to_exclude" {
23
32
description = " A list of individual AWS-managed Config Rules to exclude from deployment"
24
33
default = []
You can’t perform that action at this time.
0 commit comments