Skip to content

Commit

Permalink
Merge pull request #449 from awslabs/refactor-allresource-condition
Browse files Browse the repository at this point in the history
Refactor condition for All Resources
  • Loading branch information
bmorrissirromb authored Aug 23, 2023
2 parents 70d57fd + 31750dd commit 5130407
Show file tree
Hide file tree
Showing 5 changed files with 458 additions and 104 deletions.
16 changes: 10 additions & 6 deletions rdk/template/configManagedRule.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,14 @@
}
},
"Conditions": {
"AllResources": {
"RemoveEventScope": {
"Fn::Or": [
{
"Condition": "EventTriggered"
"Fn::Not": [
{
"Condition": "EventTriggered"
}
]
},
{
"Fn::Equals": [
Expand Down Expand Up @@ -101,14 +105,14 @@
},
"Scope": {
"Fn::If": [
"AllResources",
"RemoveEventScope",
{
"Ref": "AWS::NoValue"
},
{
"ComplianceResourceTypes": {
"Ref": "SourceEvents"
}
},
{
"Ref": "AWS::NoValue"
}
]
},
Expand Down
32 changes: 25 additions & 7 deletions rdk/template/configManagedRuleOrganization.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,14 @@
}
},
"Conditions": {
"AllResources": {
"RemoveEventScope": {
"Fn::Or": [
{
"Condition": "EventTriggered"
"Fn::Not": [
{
"Condition": "EventTriggered"
}
]
},
{
"Fn::Equals": [
Expand All @@ -68,7 +72,14 @@
"Fn::Not": [
{
"Fn::Equals": [
{ "Fn::Join": [",", { "Ref": "SourceEvents" }] },
{
"Fn::Join": [
",",
{
"Ref": "SourceEvents"
}
]
},
"NONE"
]
}
Expand All @@ -90,7 +101,14 @@
"Fn::Not": [
{
"Fn::Equals": [
{ "Fn::Join": [",", { "Ref": "ExcludedAccounts" }] },
{
"Fn::Join": [
",",
{
"Ref": "ExcludedAccounts"
}
]
},
""
]
}
Expand All @@ -116,12 +134,12 @@
},
"ResourceTypesScope": {
"Fn::If": [
"AllResources",
"RemoveEventScope",
{
"Ref": "SourceEvents"
"Ref": "AWS::NoValue"
},
{
"Ref": "AWS::NoValue"
"Ref": "SourceEvents"
}
]
},
Expand Down
31 changes: 25 additions & 6 deletions rdk/template/configManagedRuleWithRemediation.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,25 @@
}
},
"Conditions": {
"AllResources": {
"RemoveEventScope": {
"Fn::Or": [
{ "Condition": "EventTriggered" },
{
"Fn::Not": [
{
"Condition": "EventTriggered"
}
]
},
{
"Fn::Equals": [
{ "Fn::Join": [",", { "Ref": "SourceEvents" }] },
{
"Fn::Join": [
",",
{
"Ref": "SourceEvents"
}
]
},
"ALL"
]
}
Expand Down Expand Up @@ -92,9 +105,15 @@
},
"Scope": {
"Fn::If": [
"AllResources",
{ "ComplianceResourceTypes": { "Ref": "SourceEvents" } },
{ "Ref": "AWS::NoValue" }
"RemoveEventScope",
{
"Ref": "AWS::NoValue"
},
{
"ComplianceResourceTypes": {
"Ref": "SourceEvents"
}
}
]
},
"MaximumExecutionFrequency": {
Expand Down
Loading

0 comments on commit 5130407

Please sign in to comment.