Skip to main content

Schema Guard Rail

Project description

CloudFormation - Resource Schema Guard Rail

Apache 2.0 License Pull Request CI PyPI PyPI - Python Version

Notes

This is not a stable version (Beta), it's still under development

Overview

AWS CloudFormation Resource Schema Guard Rail is an open-source tool, which uses CloudFormation Guard policy-as-code evaluation engine to assess resource schema compliance. It validates json resource schemas against the AWS CloudFormation modeling best practices.

Contribute

See CONTRIBUTING for more information.

Rule Development

Read Guard Rail: Rule Development for more information on how to write resource schema rules.

How to use it?

Schema guard rail package has a built-in library of rules, that CloudFormation believe are the best practices that resource modelers should follow. It supports two types of evaluation - Basic Linting & Breaking Change;

Basic Linter (Stateless)

Linter works only with current version of resource schema and runs CloudFormation authored rules, which will highlight problematic schema constructs. A provider developers can run multiple independent schemas at once as well as attach custom rules.

In order to start using Basic Linting you need to run following command:

$ guard-rail --schema file://path-to-schema-1 --schema file://path-to-schema-2 --rule file://path-to-custom-ruleset1 --rule file://path-to-custom-ruleset2

List of Linting Rules

Breaking Change (Stateful)

Along with basic linting, guard rail supports capability of breaking change evaluation. Provider developer must provider two json objects - previous & current versions of the same resource schema. CloudFormation authored rules will be run and evaluation current version of the schema whether it is compliant or not.

In order to start using Basic Linting you need to run following command:

$ guard-rail --schema file://path-to-schema-1 --schema file://path-to-schema-2 --rule ... --stateful

List of Breaking Change Rules

*Additionally, you can specify format argument, which will produce a nicely formatted output.

How to install it locally?

Use following commands

Clone github repo

$ git clone git@github.com:aws-cloudformation/resource-schema-guard-rail.git

Create Virtual Environment & Activate

python3 -m venv env
source env/bin/activate

Install Package Locally from the root

pip install -e . -r requirements.txt
pre-commit install

Run CI Locally

# run all hooks on all files, mirrors what the CI runs
pre-commit run --all-files

License

This project is licensed under the Apache-2.0 License.

Community

Join us on Discord! Connect & interact with CloudFormation developers & experts, find channels to discuss and get help for our CLI, cfn-lint, CloudFormation registry, StackSets, Guard and more:

Join our Discord

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

resource-schema-guard-rail-0.0.10.tar.gz (22.3 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file resource-schema-guard-rail-0.0.10.tar.gz.

File metadata

File hashes

Hashes for resource-schema-guard-rail-0.0.10.tar.gz
Algorithm Hash digest
SHA256 3f5533a648d29495ca4fe237c3ba94f4e7e0f4209e0b3aecc1b20e77d1e2be0f
MD5 b99974191dd16b8bd64c2fd3deef8f0a
BLAKE2b-256 679dd8bb338f5a553549b4eb5180c87ace730a7fbe6872549ff8e4c4a4a0dfe9

See more details on using hashes here.

File details

Details for the file resource_schema_guard_rail-0.0.10-py3-none-any.whl.

File metadata

File hashes

Hashes for resource_schema_guard_rail-0.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 de3cc37d51a65d2b7eeb73fa0b09cf6e2c9ed4c0de45d9f443702dd647c96ca3
MD5 f9b97ef123b84f7335166ba8045f4a49
BLAKE2b-256 3c1a769a6ed643daaea60264452e28c7abe7424e928bcd84e76ee9f069158bf0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page