-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Larry Hitchon
committed
Apr 18, 2018
1 parent
19a7828
commit a154b48
Showing
6 changed files
with
115 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# TODO | ||
|
||
* Add an optional YAML file for project settings, such as ignoring certain rules for certain resources | ||
* Region is hard-coded to us-east-1 for GetValueFromS3 | ||
* Use type switch as more idiomatic way to handle multiple types in match.go | ||
* Use log package for error reporting | ||
* Deal with a few FIXME comments in code, mostly error handling | ||
* Would it be useful to have helper utilities to send output to CloudWatch/SNS/Kinesis? | ||
* Update value_from to handle JSON return values | ||
* Create a Provider interface for AWS calls, create a mock for testing SecurityGroupLinter | ||
* Starting to have inconsistent naming in ops: is-true, is-false, has-properties vs. present, absent, empty, null | ||
* Add options to Assertion type, for things like 'ignore-case' for string compares? Or just use a regex? | ||
* Provide a default -query of 'Violations[]', and add an option for a full report | ||
* Document conditions | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# Example Rules | ||
|
||
Add these rules to a YAML file, and pass the filename to config-lint using the -rules option. | ||
Each rule contains a list of assertions, and these assertions use operations that are [documented here](operations.md) | ||
|
||
To test that an AWS instance type has one of two values: | ||
|
||
``` | ||
Version: 1 | ||
Description: Example rules | ||
Type: Terraform | ||
Files: | ||
- "*.tf" | ||
Rules: | ||
- id: EC2_INSTANCE_TYPE | ||
message: Instance type should be t2.micro or m3.medium | ||
resource: aws_instance | ||
assertions: | ||
- key: instance_type | ||
op: in | ||
value: t2.micro,m3.medium | ||
severity: WARNING | ||
``` | ||
|
||
This could also be done by using the or operation with two different assertions: | ||
|
||
``` | ||
Version: 1 | ||
Description: Example rules | ||
Type: Terraform | ||
Files: | ||
- "*.tf" | ||
Rules: | ||
- id: EC2_INSTANCE_TYPE | ||
message: Instance type should be t2.micro or m3.medium | ||
resource: aws_instance | ||
assertions: | ||
or: | ||
- key: instance_type | ||
op: eq | ||
value: t2.micro | ||
- key: instance_type | ||
op: eq | ||
value: m3.medium | ||
severity: WARNING | ||
``` | ||
|
||
And this could also be done by looking up the valid values in an S3 object (HTTP endpoints are also supported) | ||
|
||
``` | ||
Version: 1 | ||
Description: Example rules | ||
Type: Terraform | ||
Files: | ||
- "*.tf" | ||
Rules: | ||
- id: EC2_INSTANCE_TYPE | ||
message: Instance type should be t2.micro or m3.medium | ||
resource: aws_instance | ||
assertions: | ||
- key: instance_type | ||
op: eq | ||
value_from: s3://your-bucket/instance-types.txt | ||
severity: FAILURE | ||
``` | ||
|
||
The assertions and operations were inspired by those in Cloud Custodian: http://capitalone.github.io/cloud-custodian/docs/ | ||
|
||
|
||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters