A collection of extra rules for linting cloudformation files
Project description
dwcflint - Custom rules and wrapper for Amazon's cfnlint
This Python module is a runnable module and wrapper around Amazons cfn-lint tool for Cloudformation file linting that adds a few extra rules. It is written in Python 3, lightweight (only a single dependency) and fast.
How to run in a pipeline:
# assuming you have Python 3 installed
pip3 install dwcflint
dwcflint cloudformation/cf.yaml
# or for multiple files
dwcflint 'cloudformation/*.yaml'
For an even simpler setup, you can add the installation line to your custom pipeline images and then just call beamcflint
in your project-specific pipeline step(s).
How to run locally:
pip3 install dwcflint
dwcflint cloudformation/cf.yaml
# or for multiple files
dwcflint 'cloudformation/*.yaml'
How to run tests:
python3 -m unittest discover -s tests/ -t tests/
List of rules:
- No mismatched log groups and subscription filters
- No missing endpoint types
- No missing log retention period
- No use of deprecated lambda runtimes
- No use of full access policies
- No use of leading zeroes in numbers or strings
- No missing/implicit log groups for lambdas
- No use of old style subscription filters
- No use of provisioned throughput
- No use of reserved environment variable names
- No use of reserved words for Dynamodb column names
- No malformed subscription filters
Dependencies
- cfnlint (https://pypi.org/project/cfn-lint/)
Sample output:
E1338 Error: The mapping with the key dev.examplemall-locationA.machineid and value 0600586 will have its value's leading zero(es) stripped by aws-cli. It is highly recommended that you add a leading non-numeric character and convert it back in your code or use a number without a leading zero to avoid incorrect values.
test-data/cf.yaml:24:7
W1337 The policies of DailySalesPollerExampleMall01Role contain overly broad policies: AmazonSQSFullAccess, AmazonDynamoDBFullAccess
test-data/cf.yaml:74:1
W1337 The policies of SftpUploaderRole contain overly broad policies: AmazonDynamoDBFullAccess, AmazonSSMFullAccess
test-data/cf.yaml:74:1
W1337 The policies of PutItemShipmentsLambdaRole contain too broad policy actions: s3:*
test-data/cf.yaml:342:9
E1338 Error: The resource property with the value 01 will have its value's leading zero(es) stripped by aws-cli. It is highly recommended that you add a leading non-numeric character and convert it back in your code or use a number without a leading zero to avoid incorrect values.
test-data/cf.yaml:376:7
Commandline usage
usage: beamcflint [-h] [--regions REGIONS]
[--include-experimental INCLUDEEXPERIMENTAL]
[--included-rules INCLUDEDRULES]
[--ignored-rules IGNOREDRULES]
templatefile
...
positional arguments:
templatefile The cloudformation yaml file to be linted
optional arguments:
-h, --help show this help message and exit
--regions REGIONS A comma-separated list of AWS regions
--include-experimental INCLUDEEXPERIMENTAL
Include experimental rules from Amazon?
--included-rules INCLUDEDRULES
A comma-separated list of rule ids to include
--ignored-rules IGNOREDRULES
A comma-separated list of rule ids to exclude
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dwcflint-1.2.14.tar.gz
(14.3 kB
view details)
Built Distribution
dwcflint-1.2.14-py3-none-any.whl
(31.3 kB
view details)
File details
Details for the file dwcflint-1.2.14.tar.gz
.
File metadata
- Download URL: dwcflint-1.2.14.tar.gz
- Upload date:
- Size: 14.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.6.1 requests/2.25.0 setuptools/38.5.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d591f65cb1f788d13150f9159795941e9cb554a331f80eca6dc7aa403a36fc09 |
|
MD5 | aa1aa19c0c5ef8dae001fb85b5b0913e |
|
BLAKE2b-256 | e3ce716e82169393405be4e6a8081efe97adccf78b9dbb9b64f5fc3d09e4029a |
File details
Details for the file dwcflint-1.2.14-py3-none-any.whl
.
File metadata
- Download URL: dwcflint-1.2.14-py3-none-any.whl
- Upload date:
- Size: 31.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.6.1 requests/2.25.0 setuptools/38.5.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6301b3da149a104e3987c9d9a1734fcb2f707fd5bf10bb8f2d995f0752466f1 |
|
MD5 | f0a802385c5510cff16880c80afd438d |
|
BLAKE2b-256 | f589264a3d32e310b549f2bd9d0776f0ec989d026acee224f2a02b4a1b59e3b9 |