auster 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +7 -0
  2. data/.editorconfig +13 -0
  3. data/.gitignore +9 -0
  4. data/.rspec +2 -0
  5. data/.rubocop.yml +41 -0
  6. data/.travis.yml +5 -0
  7. data/CODE_OF_CONDUCT.md +74 -0
  8. data/Gemfile +3 -0
  9. data/LICENSE.txt +21 -0
  10. data/README.md +152 -0
  11. data/Rakefile +6 -0
  12. data/auster.gemspec +37 -0
  13. data/bin/auster +8 -0
  14. data/bin/console +8 -0
  15. data/example-repo/.auster.yaml +0 -0
  16. data/example-repo/cfer-helpers/.keep +0 -0
  17. data/example-repo/config/.keep +0 -0
  18. data/example-repo/config/schema.yaml +10 -0
  19. data/example-repo/config/us-west-2/dev-ed1.yaml +7 -0
  20. data/example-repo/config/validator.rb +5 -0
  21. data/example-repo/steps/.keep +0 -0
  22. data/example-repo/steps/00.bootstrap/.keep +0 -0
  23. data/example-repo/steps/00.bootstrap/cfer/defs/s3.rb +3 -0
  24. data/example-repo/steps/00.bootstrap/cfer/outputs.rb +1 -0
  25. data/example-repo/steps/00.bootstrap/cfer/parameters.rb +0 -0
  26. data/example-repo/steps/00.bootstrap/cfer/require.rb +0 -0
  27. data/example-repo/steps/00.bootstrap/on-create.d/00-debug.rb +4 -0
  28. data/example-repo/steps/00.bootstrap/on-destroy.d/00-debug.rb +4 -0
  29. data/example-repo/steps/00.bootstrap/post-converge.d/00-debug.rb +5 -0
  30. data/example-repo/steps/00.bootstrap/pre-converge.d/00-debug.rb +4 -0
  31. data/example-repo/steps/01.dependent/.keep +0 -0
  32. data/example-repo/steps/01.dependent/cfer/defs/s3.rb +3 -0
  33. data/example-repo/steps/01.dependent/cfer/outputs.rb +1 -0
  34. data/example-repo/steps/01.dependent/cfer/parameters.rb +0 -0
  35. data/example-repo/steps/01.dependent/cfer/require.rb +0 -0
  36. data/example-repo/steps/01.dependent/on-create.d/00-debug.rb +4 -0
  37. data/example-repo/steps/01.dependent/on-destroy.d/00-debug.rb +4 -0
  38. data/example-repo/steps/01.dependent/post-converge.d/00-debug.rb +7 -0
  39. data/example-repo/steps/01.dependent/pre-converge.d/00-debug.rb +5 -0
  40. data/lib/cfer/auster/cfer_evaluator.rb +125 -0
  41. data/lib/cfer/auster/cfer_helpers.rb +71 -0
  42. data/lib/cfer/auster/cli/_shared.rb +49 -0
  43. data/lib/cfer/auster/cli/destroy.rb +34 -0
  44. data/lib/cfer/auster/cli/generate/repo.rb +27 -0
  45. data/lib/cfer/auster/cli/generate/step.rb +27 -0
  46. data/lib/cfer/auster/cli/generate.rb +35 -0
  47. data/lib/cfer/auster/cli/json.rb +44 -0
  48. data/lib/cfer/auster/cli/nuke.rb +62 -0
  49. data/lib/cfer/auster/cli/run.rb +34 -0
  50. data/lib/cfer/auster/cli.rb +60 -0
  51. data/lib/cfer/auster/config.rb +70 -0
  52. data/lib/cfer/auster/logging.rb +32 -0
  53. data/lib/cfer/auster/param_validator.rb +22 -0
  54. data/lib/cfer/auster/repo.rb +158 -0
  55. data/lib/cfer/auster/script_executor.rb +57 -0
  56. data/lib/cfer/auster/step.rb +181 -0
  57. data/lib/cfer/auster/version.rb +5 -0
  58. data/lib/cfer/auster.rb +22 -0
  59. metadata +270 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 53c4b1f54eb6c85806e15fd5d0c10d084237143c
4
+ data.tar.gz: 8fc7812b3c331168454559e81780a390214b1ff0
5
+ SHA512:
6
+ metadata.gz: 74bcbed24f715040cabe0063e56a77f8beeeedd8d3223a3480d2507ffa7f28e35014fb85681f64e169de51993802b91e9d8c92850a463363b98da38bab4ccc12
7
+ data.tar.gz: 229f261906b6843db306c25a569f9dec2324038b2b0dbb638f04254f7e89199b8644d3b6af02c52d9493aba2692aec3be66b914cf09fbc9b43e6791798be5ff0
data/.editorconfig ADDED
@@ -0,0 +1,13 @@
1
+ [*]
2
+ insert_final_newline = true
3
+ charset = utf-8
4
+
5
+ [*.md]
6
+ indent_style = space
7
+ indent_size = 2
8
+ trim_trailing_whitespace = true
9
+
10
+ [*.{js,json,rb}]
11
+ indent_style = space
12
+ indent_size = 2
13
+ trim_trailing_whitespace = true
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.rubocop.yml ADDED
@@ -0,0 +1,41 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.3
3
+ Exclude:
4
+ - "*.gemspec"
5
+
6
+ Metrics/AbcSize:
7
+ Enabled: false # because ABC tells you nothing useful!
8
+
9
+ Metrics/LineLength:
10
+ Max: 120
11
+
12
+ Metrics/BlockLength:
13
+ Exclude:
14
+ - "Rakefile"
15
+ - "spec/**/*.rb"
16
+
17
+ Metrics/ClassLength:
18
+ Max: 1500
19
+
20
+ Metrics/MethodLength:
21
+ Max: 35
22
+
23
+ Metrics/ModuleLength:
24
+ Max: 1500
25
+ Exclude:
26
+ - "spec/**/*.rb"
27
+
28
+ Metrics/ParameterLists:
29
+ Enabled: false # this is a really strange thing when you use named parameters.
30
+
31
+ Style/StringLiterals:
32
+ EnforcedStyle: double_quotes
33
+
34
+ Style/Documentation:
35
+ Enabled: false
36
+
37
+ Style/DoubleNegation:
38
+ Enabled: false # avoids dangling object pointers
39
+
40
+ Performance/RedundantBlockCall:
41
+ Enabled: false # because `block.call` is more explicit than a "yield" somewhere down low
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.0
5
+ before_install: gem install bundler -v 1.13.6
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at ed@edropple.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Ed Ropple
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,152 @@
1
+ # Auster #
2
+ _The Best Way To Wrangle CloudFormation (at least, according to me!)_
3
+
4
+ **Auster** is a best-practices extension to the [Cfer](https://github.com/seanedwards/cfer) environment that establishes conventions for effectively working with Cfer and CloudFormation. It's developed from some of the lessons that I've learned over time building out large-scale systems for companies big and small and running into the stumbling blocks that always pop up when trying to automate a full stack deployment.
5
+
6
+ The biggest roadblock to making your deployment awesome is the impedance mismatch between tools like CloudFormation (and implicitly Cfer) and the world you're working in. CloudFormation is a declarative system: "this should exist when you're done". And that's great...until you have to start introducing stateful changes to your system! (Which, if you're doing it right, will be approximately "five seconds after you stand up an RDS server.") This is where Auster comes in, allowing you to orchestrate those stateful transitions between steps.
7
+
8
+ **Caveat emptor:** The code that became Auster has been in use for a few months, but Auster itself is very much a work in progress. I use this for stuff that pays money and I'll stand behind it, but you should make your own call.
9
+
10
+ ## Give It A Try ##
11
+ Auster is installable via Rubygems (`gem install auster`), but the example repo is in the same repository, so checking it out is recommended.
12
+
13
+ ```bash
14
+ $ gem install auster
15
+ $ git clone git@github.com:eropple/auster.git
16
+ $ cd auster/example-repo
17
+ ```
18
+
19
+ Take a look around the repo if you'd like. Ensure that you have valid AWS credentials in your environment (`AWS_PROFILE`, etc.) and then run the following to create a pair of CloudFormation stacks. All they'll do is create S3 buckets, so you won't be charged for anything.
20
+
21
+ ```bash
22
+ $ auster run us-west-2/dev-ed1 bootstrap
23
+ $ auster run us-west-2/dev-ed1 dependent
24
+ ```
25
+
26
+ If you read through the Auster output, you'll see that it's creating S3 buckets (as you'd expect--it's still CloudFormation under the hood) and registering them as region-wide exports, prefixed with the plan ID `dev1-ed`.
27
+
28
+ Anyhoo, let's clean up.
29
+
30
+ ```bash
31
+ $ auster nuke us-west-2/dev-ed1
32
+ ```
33
+
34
+ If you'd like more information on writing Cfer itself, check out [chef-cfer-consul-cluster](https://github.com/seanedwards/chef-cfer-consul-cluster).
35
+
36
+ ## Auster Commands ##
37
+ ### Generators ###
38
+ - `auster generate repo` - Creates a Auster plan repo with sample files.
39
+ - `auster generate step ##.human-tag` - Creates a new Auster step with stub files.
40
+
41
+ ### Executors ###
42
+ **Note:** In the command line interface, the step number and the tag are interchangeable. `auster run region/env 00` and `auster run region/env human-tag` will refer to the same step, `00.human-tag`.
43
+
44
+ - `auster json us-west-2/dev1-ed (##|human-tag)` - Uses `cfer generate` to generate the output JSON that will be applied when this step is `auster run`'d.
45
+ - `auster run us-west-2/dev1-ed (##|human-tag)` - Runs step 01 in region `us-west2` with configuration set `dev1-ed`. This will:
46
+ - If `/cfg/_schema.yaml` exists, it will validate `/cfg/us-west2/dev1-ed.yaml` against it and fail if it does not validate.
47
+ - If this is the first run of this step (there is no `dev1-ed-step01` CloudFormation stack in AWS), the scripts in `/steps/01/on-create.d` will be run in lexicographic order.
48
+ - The scripts in `/steps/01/pre-converge.d` will be run in lexicographic order.
49
+ - Cfer will be run against the scripts in `/steps/01/cfer` to generate and apply the desired CloudFormation template.
50
+ - The scripts in `/steps/01/post-converge.d` will be run in lexicographic order.
51
+ - `auster destroy us-west-2/dev1-ed (##|human-tag)` - Destroys step 01 in region `us-west2` with configuration set `dev1-ed`. This will:
52
+ - Attempt to destroy the CloudFormation stack `dev1-ed-step01`. _This is not guaranteed to succeed_, especially if this stack has exports being used by other stacks.
53
+ - If the stack is destroyed successfully, the scripts in `/steps/01/on-destroy.d` will be run in lexicographic order.
54
+ - `auster nuke us-west-2/dev1-ed` - Destroys _all_ steps in `dev1-ed` in region `us-west2`. This will request a confirmation (and will error out if no TTY is detected); you must pass the `--force` parameter to automate this destruction.
55
+
56
+ ## Auster Config Sets ##
57
+ A _config set_ is a YAML file that combines Cfer parameters and Auster directives. This file may optionally be proofed with a Kwalify YAML schema in `/config/schema.yaml` and, once loaded, the loaded parameters can be proofed via a `Cfer::Auster::ParamValidator` specified in `/config/validator.rb`.
58
+
59
+ All Auster-specific parameters are stored under the `AusterOptions` key.
60
+
61
+ - `AusterOptions`
62
+ - `S3Path`: Specifies an S3 path at which to upload the CloudFormation stack template. (This is required once your stack definition grows over a certain size; I recommend you always use it.) For Cfer uses, this is both `--s3-path` and `--force-s3`.
63
+
64
+ ## Auster Event Scripts ##
65
+ There are four events for every step at which arbitrary scripts can be run: `on-create`, `pre-converge`, `post-converge`, and `on-destroy`. (Yes, that the lexicographic ordering of `post` comes before `pre` drives me up the wall too. Sorry.) Every script in the appropriate directory within each step will be executed (based on chmod status via `File::executable?`). Ruby scripts will be loaded in-process and run directly, while all other scripts will be invoked via `system()` (so on Unixes the shebang will be evaluated, etc.).
66
+
67
+ Some folks have asked why we have `pre-converge` and `post-converge` steps. The reason for this is because occasionally your cloud stack is going to require manual intervention. But you might want to react to that manual intervention before starting the next step--so you can prompt your operator to perform their manual task in Step X's `post-converge` and react to it in Step X+1's `pre-converge`.
68
+
69
+ While this gem _should_ in all cases be Windows-compatible, event scripts are the most likely place to run into jank. Your PowerShell and batch scripts _should_ work but this is not guaranteed. Bug reports and pull requests welcome. Obviously, running those scripts in a cross-platform way is a total no-go, so if you need to run in a cross-platform environment you should stick to writing your scripts in Ruby.
70
+
71
+ **Important:** `pre-converge` and `post-converge` _will_ run even if there are no changes applied to CloudFormation resources. This makes Auster a handy place to do stuff like rolling database credentials.
72
+
73
+ ### Environment Variables in Event Scripts ###
74
+ - `PLAN_ID`: the identifier of this Auster stack, i.e., for `us-west-2/dev-ed1` `PLAN_ID` would equal `dev-ed1`.
75
+ - `AWS_REGION`/`AWS_DEFAULT_REGION`: the AWS region of this Auster stack
76
+
77
+ ### Ruby Methods in Event Scripts ###
78
+ - `plan_id`: the identifier of this Auster stack, as per `PLAN_ID`.
79
+ - `aws_region`: the AWS region of this Auster stack, as per `AWS_REGION`.
80
+ - `repo`: the `Cfer::Auster::Repo` object representing the entire repo.
81
+ - `config_set`: the `Cfer::Auster:Config` object representing the collection of parameters related to this environment.
82
+ - `exports(export_plan_id = PLAN_ID)`: fetches all CloudFormation exports for a given plan (by default, the one of the secuting stack). The preferred method of accessing data from a dependent stack.
83
+ - `repo.step_by_tag(tag).cfn_data(config_set)`: retrieves all parameters and outputs of a given step and environment.
84
+
85
+ ## Auster Cfer Scripts ##
86
+ **Note:** Auster wraps Cfer at an API level rather than at a command-line level, so feature parity is an ongoing process. In particular, stack policies are not currently supported--it's a mix of not having a Ruby DSL for them and not having a direct need for them myself at the moment. Pull requests welcome!
87
+
88
+ Auster uses a convention-based arrangement for structuring the Cfer scripts that will be processed into CloudFormation. The order of evaluation is as follows:
89
+
90
+ - `/cfer-helpers/**/*.rb` - global-scope helpers.
91
+ - `/steps/##.tag/cfer/helpers/**/*.rb` - script-scope helpers.
92
+ - `/steps/##.tag/cfer/require.rb` - intended for checking preconditions, requiring libraries used downstream (my favorite is `ipaddress`!), etc.
93
+ - `/steps/##.tag/cfer/parameters.rb` - intended for defining `parameter`s.
94
+ - `/steps/##.tag/cfer/exports.rb` - intended for defining `output`s and `export`s.
95
+ - `/steps/##.tag/cfer/defs/**/*.rb` - intended for defining `resource`s.
96
+
97
+ ### Auster Cfer Helpers ###
98
+ - `import_value(name)`: Wrapper around `Fn::ImportValue` that prepends the current plan's ID to the name in question.
99
+ - `export(name, value)`: Wrapper around `output` to export the value in question. Prepends the plan's ID in the same way that `import_value` expects.
100
+
101
+ ## Structure ##
102
+ Each Auster plan is laid out as per the following directory structure:
103
+
104
+ - `/`
105
+ - `/.auster.yaml` - Currently empty; intended for future global configuration. (Necessary to find the base of a repo, a la Rakefile/Gemfiles.)
106
+ - `/Gemfile` - Used for script dependencies, etc. as per usual. (You should probably require `auster` here too, to version-pin it.)
107
+ - `/config`
108
+ - `/schema.yaml` - (optional) a [Kwalify](http://www.kuwata-lab.com/kwalify/ruby/users-guide.html) schema against which a configuration file will be checked before any operations can be taken.
109
+ - `/validator.rb` - (optional) a `Cfer::Auster::ParamValidator` that, if it exists, will be run against the parameter set _after_ YAML loading but _before_ Cfer is run.
110
+ - `/us-west-2` - the AWS region for this configuration set. (This value is not typechecked.)
111
+ - `/dev1-ed.yaml` - a YAML file that will be surfaced as Cfer parameters
112
+ - The basename (filename sans extension) must begin with an alphabetic character and may only contain alphanumerics (case sensitive) and numbers. It must be under 16 characters in length.
113
+ - The filename sans extension will be used as an identifier for steps executed with its configuration, i.e. the CloudFormation stack for `dev1-ed` will be called `dev1-ed-step00` and exports from a step in `dev1-ed` will be called `dev1-ed-YourExportName`.
114
+ - This identifier is exposed in your Cfer scripts as `parameters[:AusterID]`.
115
+ - This parameter set will be checked into source control and so should have _no_ secrets in it! This is for configuration parameters like:
116
+ - VPC CIDR block allocation
117
+ - Autoscaling group sizes
118
+ - Instance sizes
119
+ - Domain names (for feeding into Route 53)
120
+ - The AWS region of this stack is exposed in your Cfer scripts as `parameters[:AWSRegion]`.
121
+ - `/cfer-helpers`
122
+ - A set of Ruby files that are included into every Cfer scope. Intended for global-scope helper methods.
123
+ - `/steps`
124
+ - `/00.human-tag`
125
+ - `/cfer`
126
+ - `/defs`
127
+ - A set of Ruby files containing Cfer `resource` declarations. These will be evaluated in lexicographic order, but should not be reliant on behaviors in any other file!
128
+ - `helpers`
129
+ - A set of Ruby files that will be included into the Cfer scope. Intended for script-specific helper methods.
130
+ - `/parameters.rb` - Cfer `parameter` invocations and `Auster.import` calls (which will be automatically prepended with the stack name).
131
+ - `/outputs.rb` - Cfer `output` invocations and `Auster.export` calls (which will be automatically prepended with the stack name).
132
+ - `/require.rb` - every other Cfer file will be executed in the context of `require.rb`. This is not guaranteed to be executed only once and so no stateful changes should be made here.
133
+ - `/on-create.d`
134
+ - A set of scripts to be run when the step is first executed.
135
+ - `/on-destroy.d`
136
+ - A set of scripts to be run when the Cfer stack is being torn down.
137
+ - `/pre-converge.d`
138
+ - A set of scripts to be run at the start of the Cfer run.
139
+ - `/post-converge.d`
140
+ - A set of scripts to be run at the successful end of the Cfer run.
141
+ - `/01.human-tag`
142
+ - ...
143
+ - `/02.human-tag`
144
+ - ...
145
+
146
+ ## Contributing ##
147
+ Bug reports and pull requests are welcome on GitHub at https://github.com/eropple/cfer-auster. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct. (And I mean it.)
148
+
149
+
150
+ ## License ##
151
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
152
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/auster.gemspec ADDED
@@ -0,0 +1,37 @@
1
+ # coding: utf-8
2
+ # frozen_string_literal: true
3
+ lib = File.expand_path("../lib", __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require "cfer/auster/version"
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "auster"
9
+ spec.version = Cfer::Auster::VERSION
10
+ spec.authors = ["Ed Ropple"]
11
+ spec.email = ["ed+auster@edropple.com"]
12
+
13
+ spec.summary = "Best-practices tooling for CloudFormation and AWS."
14
+ spec.homepage = "https://github.com/eropple/auster"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+ spec.bindir = "bin"
21
+ spec.executables = ["auster"]
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.13"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "rspec", "~> 3.0"
27
+ spec.add_development_dependency "pry"
28
+
29
+ spec.add_runtime_dependency "cri", "~> 2.8.0"
30
+ spec.add_runtime_dependency "search_up", "~> 1.0.2"
31
+ spec.add_runtime_dependency "activesupport", "~> 5.0.2"
32
+ spec.add_runtime_dependency "ice_nine", "~> 0.11.2"
33
+ spec.add_runtime_dependency "kwalify", "~> 0.7.2"
34
+ spec.add_runtime_dependency "cfer", "~> 0.5.0"
35
+ spec.add_runtime_dependency "semantic", "~> 1.6.0"
36
+ spec.add_runtime_dependency "aws-sdk", "~> 2.9.11"
37
+ end
data/bin/auster ADDED
@@ -0,0 +1,8 @@
1
+ #! /usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ lib = File.expand_path("../lib", __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+
6
+ require "cfer/auster/cli"
7
+
8
+ Cfer::Auster::CLI.execute(ARGV)
data/bin/console ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "cfer/auster"
6
+
7
+ require "pry"
8
+ Pry.start
File without changes
File without changes
File without changes
@@ -0,0 +1,10 @@
1
+ type: map
2
+ mapping:
3
+ Foo: { type: int, required: yes }
4
+ Bar: { type: scalar, required: no }
5
+ Baz:
6
+ type: map
7
+ mapping:
8
+ Something: { type: bool, required: yes }
9
+ Else: { type: bool, required: no }
10
+ Okay: { type: scalar, required: yes }
@@ -0,0 +1,7 @@
1
+ Foo: 1
2
+ Bar: ~
3
+
4
+ Baz:
5
+ Something: yes
6
+ Else: no
7
+ Okay: sure
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ Cfer::Auster::ParamValidator.new do |parameters, errors|
4
+ errors << "nope" if parameters.nil?
5
+ end
File without changes
File without changes
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ resource :TempBucket, "AWS::S3::Bucket" do; end
@@ -0,0 +1 @@
1
+ export :TempBucket1, Fn.ref(:TempBucket)
File without changes
@@ -0,0 +1,4 @@
1
+ #! /usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ logger.info "!! step 00, on-create"
@@ -0,0 +1,4 @@
1
+ #! /usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ logger.info "!! step 00, on-destroy"
@@ -0,0 +1,5 @@
1
+ #! /usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ logger.info "!! step 00, post-converge"
5
+ logger.info "Exported TempBucket1: #{exports[:TempBucket1]}"
@@ -0,0 +1,4 @@
1
+ #! /usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ logger.info "!! step 00, pre-converge"
File without changes
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ resource :TempBucket, "AWS::S3::Bucket" do; end
@@ -0,0 +1 @@
1
+ export :TempBucket2, import(:TempBucket1)
File without changes
@@ -0,0 +1,4 @@
1
+ #! /usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ logger.info "!! step 01, on-create"
@@ -0,0 +1,4 @@
1
+ #! /usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ logger.info "!! step 01, on-destroy"
@@ -0,0 +1,7 @@
1
+ #! /usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ logger.info "!! step 01, post-converge"
5
+ logger.info exports.inspect
6
+ logger.info "Exported TempBucket1: #{exports[:TempBucket1]}"
7
+ logger.info "Exported TempBucket2: #{exports[:TempBucket2]}"
@@ -0,0 +1,5 @@
1
+ #! /usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ logger.info "!! step 01, pre-converge"
5
+ logger.info "Exported TempBucket1: #{exports[:TempBucket1]}"