Stax Examples
This project is a bunch of generators for
stax, to demonstrate the creation
of stacks and/or individual resources for Cloudformation using stax
.
Currently, generators all use the cfer wrapper to generate templates from ruby code. We may add json and/or yaml template examples later.
These templates are all just an expression of the author's ideas about Cloudformation architecture and style. Stacks and highly de-coupled and orthogonal, and use Outputs/Exports and Imports very heavily to wire related stacks up to each other.
You are encouraged to use these merely as a starting-point for boilerplate, and then modify to your needs. Even better, fork and create generators embodying your opinions instead.
Installation
Add this line to your application's Gemfile:
gem 'stax-examples'
or use HEAD
with:
gem 'stax-examples', git: 'https://github.com/rlister/stax-examples'
And then execute:
$ bundle
Or install it yourself as:
$ gem install stax-examples
Usage
require
the gem wherever you put such things, such as your
Staxfile
:
require 'stax/examples'
You should now see your new generators listed:
$ bundle exec stax g
Use a generator by name to create your new boilerplate in lib/
and
cf/
, e.g.:
$ bundle exec stax g vpc
cidr block for vpc? (10.0.0.0/16)
number of subnets to create? (3)
create cf
create cf/vpc.rb
create cf/vpc/endpoints.rb
create cf/vpc/subnets.rb
create cf/vpc/vpc.rb
append Staxfile
As seen above, most generators will query interactively for any decisions they would like you to make.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/rlister/stax-examples. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
How to create a new a generator?
For creating a new generator, you can use stax generate genator NAME
, where NAME
is your new generator name, i.e. apigw
for API Gateway.
Then for testing it your brand new generator:
cd stax-examples/test
bundle install
bundle exec stax generate NAME
License
The gem is available as open source under the terms of the MIT License.
Code of Conduct
Everyone interacting in the Stax::Examples project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.