Gradle plugin to provide full automation for a CloudFormation project. This includes static analysis of the CloudFormation templates themselves as well as automation to deploy a stack from a template
- Syntax Validation - CloudFormation template syntax is checked against CloudFormation specifications. All resources defined are check to make sure the match what CloudFormation is expecting.
- Best Practices Check - CloudFormation template is analyzed for any deviation from CloudFormation best practices
- Stack Deployment -CloudFormation stack deployed from CloudFormation template
- Test Results - All tests that are performed throughout the
build
anddeploy
process are captured and recorded in a JUnit-style XML report.
There are two prerequisites required to exist prior to using this plugin:
cfn-lint is used for basic linting and sytax validation of CloudFormation templates.
To install cfn-lint
utility, run the following:
pip install cfn-lint
cfn_nag is used for CloudFormation template static analysis to ensure templates are adhering to best practices.
To install cfn_nag
utility, run the following:
gem install cfn-nag
awscli is used to perform some post deploy checks after CloudFormation stack has been updated / created.
To install awscli
utility, run the following:
brew install awscli
To use this plugin, the following buildscript repositories and dependencies must be configured:
buildscript {
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
classpath 'com.github.warlordofmars:gradle-cloudformation-helper:release-0.1.8'
}
}
Then to apply the plugin:
apply plugin: 'com.github.warlordofmars.gradle.cloudformation'
To configure:
cloudformation {
// the name of the cloudformation stack
stackName = '<some_stack_name>'
// the cloudformation template file
templateFile = file(rootProject.cloudformationSource)
// an existing S3 bucket that can be used to host the cloudformation template
templateBucket = rootProject.cloudformationBucket
// a mapping of stack parameters and their values to be used
stackParams = [
ParamName: '<Some_Param_Value>',
AnotherParamName: '<Some_Other_Param_Value>'
]
// is this build part of promote step?
isPromote = System.env.containsKey('PROMOTE)
}
Versioning on this project is applied automatically on all changes using the axion-release-plugin. Git tags are created for all released versions, and all available released versions can be viewed in the Releases section of this project.
- John Carter - warlordofmars
This project is licensed under the MIT License - see the LICENSE.md file for details
- Using the gradle-aws-plugin for AWS API interactions (create / update / delete CloudFormation stacks)
- Using cfn_nag for CloudFormation template static analysis to ensure templates are adhering to best practices
- Using cfn-lint for basic linting and sytax validation of CloudFormation templates
- Using the warlordofmars gradle plugin, gradle-release-helper, for automatic versioning, git tagging, and publishing of releases to GitHub
- Using the warlordofmars gradle plugin, gradle-customtest-helper, for recording custom test results to junit-style XML report
- Using the warlordofmars gradle plugin, gradle-prerequisites-check, for validating all required custom prerequisite binaries are already installed on build system
- Using the warlordofmars custom gradle distribution warlordofmars-gradle in order to define default repositories to avoid duplication across all projects
- Using the warlordofmars jenkins pipeline library jenkins-library for re-usable CI/CD pipeline components