Skip to main content

Evaluate and unit test CloudFormation templates

Project description

cfneval

cfneval is a Python tool for taking a CloudFormation template and evaluating all the conditional logic in order to come up with the effective template that actually gets used. You can use the tool just to see what the effective version looks like, or you can run it as part of a behave test suite to automatically regression test your CloudFormation template.

Step Documentation

Quickstart Guide

Step Reference

Compatability Guide

CLI Usage

Usage: cfneval  [OPTIONS]

Options:
  -p, --parameter <TEXT TEXT>...
  -t, --template TEXT             [required]
  -o, --output TEXT
  --account-id TEXT
  --region TEXT
  --help                          Show this message and exit.

template

Use the -t or --template argument to point to the CloudFormation template you want to evaluate. cfneval will auto-detect whether the template is in json or yaml format. It will use cfnflip to parse yaml templates.

parameters

Use the -p or --parameter argument multiple times to specify the parameters that will be passed into the CloudFormation template.

output

Use the -o or --output argument to specify the filename to write the effective template to. If this argument is omitted, then the effective template will be written to stdout instead of to a file. The output will be in the same format as the input.

account-id

Use the --account-id argument to simulate evaluating the template in a specific account. It defaults to 123456789012.

region

Use the --region argument to simulate evaluating the template in another region. It defaults to us-east-1.

Behave CLI usage

cfneval comes with a wrapper around behave called behave-cfn. That wrapper comes with the cfneval given/when/then's pre-registered and ready to use. You just need to put your features in a features folder.

Behave steps usage

cfneval can be integrated directly into a behave project. Add the following code into a step file within features/steps/.

from cfneval.behave_steps import register_behave_steps

register_behave_steps()

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

cfneval-1.2.0.tar.gz (15.4 kB view details)

Uploaded Source

File details

Details for the file cfneval-1.2.0.tar.gz.

File metadata

  • Download URL: cfneval-1.2.0.tar.gz
  • Upload date:
  • Size: 15.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.16

File hashes

Hashes for cfneval-1.2.0.tar.gz
Algorithm Hash digest
SHA256 c446c2b9b02716be3c658849d16b092c3c0fa7565443d10ab59f0065f72fba01
MD5 6e3a6afb6b40a4437c1899c667bd57b3
BLAKE2b-256 61b6c0ac1008d6d90c60c03716376785c72f8304dab3dd83dd5ef2bdd072fbb3

See more details on using hashes here.

Supported by

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