Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add partial support for Proactive rules #499

Merged
merged 5 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Resources:
- 'Config Rules Compliance Change'
detail:
configRuleName:
- !Ref S3BucketServerSideEncryptionEnabled
- Ref: S3BucketServerSideEncryptionEnabled
newEvaluationResult:
complianceType:
- NON_COMPLIANT
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
[tool.poetry]
name = "rdk"
version = "0.17.11"
version = "0.17.12"
description = "Rule Development Kit CLI for AWS Config"
authors = [
"AWS RDK Maintainers <rdk-maintainers@amazon.com>",
Expand Down Expand Up @@ -123,6 +123,7 @@ isort = {extras = ["toml"], version = "^5.11.4"}
mypy = "^1.3.0"
debugpy = "^1.6.7"
ruff = "^0.0.269"
checkov = "^3.2.0"

[tool.poetry.group.security.dependencies]
bandit = "^1.7.7"
Expand Down
2 changes: 1 addition & 1 deletion rdk/__init__.py
depaolism marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
#
# or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

MY_VERSION = "0.17.11"
MY_VERSION = "2"
103 changes: 61 additions & 42 deletions rdk/rdk.py

Large diffs are not rendered by default.

142 changes: 0 additions & 142 deletions rdk/template/configManagedRule.json

This file was deleted.

102 changes: 102 additions & 0 deletions rdk/template/configManagedRule.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
AWSTemplateFormatVersion: "2010-09-09"
Description: AWS CloudFormation template to create Managed AWS Config rules. You
will be billed for the AWS resources used if you create a stack from this
template.
Parameters:
RuleName:
Description: Name of the Rule
Type: String
MinLength: "1"
MaxLength: "128"
Description:
Description: Description of the Rule
Type: String
MinLength: "1"
MaxLength: "255"
SourceEvents:
Description: Event Type
Type: CommaDelimitedList
Default: NONE
SourcePeriodic:
Description: Execution Frequency
Type: String
MinLength: "1"
MaxLength: "255"
Default: NONE
SourceIdentifier:
Description: Source Identifier of Managed Rule
Type: String
MinLength: "1"
MaxLength: "255"
SourceInputParameters:
Description: Input Parameters
Type: String
Default: "{}"
EvaluationMode:
Description: The evaluation mode to use, either DETECTIVE, PROACTIVE, or BOTH.
Type: String
Default: DETECTIVE
AllowedValues:
- DETECTIVE
- PROACTIVE
- BOTH
Conditions:
RemoveEventScope:
Fn::Or:
- Fn::Not:
- Condition: EventTriggered
- Fn::Equals:
- Fn::Join:
- ","
- Ref: SourceEvents
- ALL
EventTriggered:
Fn::Not:
- Fn::Equals:
- Fn::Join:
- ","
- Ref: SourceEvents
- NONE
PeriodicTriggered:
Fn::Not:
- Fn::Equals:
- Ref: SourcePeriodic
- NONE
UseBothEvaluationModes:
Fn::Equals:
- Ref: EvaluationMode
- "BOTH"
Resources:
rdkConfigRule:
Type: AWS::Config::ConfigRule
Properties:
ConfigRuleName:
Ref: RuleName
Description:
Ref: Description
Scope:
Fn::If:
- RemoveEventScope
- Ref: AWS::NoValue
- ComplianceResourceTypes:
Ref: SourceEvents
MaximumExecutionFrequency:
Fn::If:
- PeriodicTriggered
- Ref: SourcePeriodic
- Ref: AWS::NoValue
Source:
Owner: AWS
SourceIdentifier:
Ref: SourceIdentifier
InputParameters:
Ref: SourceInputParameters
EvaluationModes:
Fn::If:
- UseBothEvaluationModes
-
- Mode: DETECTIVE
- Mode: PROACTIVE
-
- Mode:
Ref: EvaluationMode
Loading