tfmod-generator 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.travis.yml +19 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +38 -0
- data/Rakefile +17 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/bin/tfmod +49 -0
- data/lib/tfmod/generator/version.rb +5 -0
- data/lib/tfmod/generator.rb +9 -0
- data/templates/CHANGELOG.md.erb +8 -0
- data/templates/Readme.md.erb +39 -0
- data/templates/gitignore.erb +4 -0
- data/templates/main.tf.erb +1 -0
- data/templates/outputs.tf.erb +7 -0
- data/templates/variables.tf.erb +13 -0
- data/tfmod-generator.gemspec +35 -0
- metadata +138 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2b60425a9f6008734d920ddbda2cb7d1a4db15ca
|
4
|
+
data.tar.gz: a902475b2df872d3b1b89efb2e9b32099f52bca5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3eeedcca211b848461557aa338fb2cf1d7b793290ea69e8edb3836469fe66449fec4f36aa74fae0b2839cfdbf50a53190105c62abb7c3524c21c73e47ced6f35
|
7
|
+
data.tar.gz: 30f242416239f75a173a3f03149f542c2581ebbf0608d531f2fa7b58fcc9f9b63028540ff3674e873263f13a835f59182a885c24e72aeb1672e77d116258e9a1
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
sudo: required
|
2
|
+
|
3
|
+
language: ruby
|
4
|
+
|
5
|
+
before_install:
|
6
|
+
- gem install bundler -v 1.13.7
|
7
|
+
|
8
|
+
script:
|
9
|
+
- bundle exec rake test
|
10
|
+
|
11
|
+
rvm:
|
12
|
+
- 2.4.0
|
13
|
+
|
14
|
+
deploy:
|
15
|
+
provider: rubygems
|
16
|
+
api_key:
|
17
|
+
secure: EKpsyP07VCbhH4Y/kF00ylB14R1iRekrmqcsC6No1Cf2dELwqeypQfwo3lLTZXhB0DjjgZSuXcnzw+QRTx+xZ6U7gsLrGDoKMd/irr+TBb2qyQhSBmjYuxHAWnRBtFdxWztsh77qi2SVDG7VIaJ94HnTTEjvaRhabsrOUI80MD8=
|
18
|
+
on:
|
19
|
+
tags: true
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -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 zane.williamson@gmail.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
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 zane
|
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,38 @@
|
|
1
|
+
# Tfmod::Generator
|
2
|
+
|
3
|
+
## Installation
|
4
|
+
|
5
|
+
$ gem install tfmod-generator
|
6
|
+
|
7
|
+
## Usage
|
8
|
+
|
9
|
+
To generate a git source driven Terraform module, example command:
|
10
|
+
|
11
|
+
```
|
12
|
+
$ tfmod zookeeper
|
13
|
+
create zookeeper/Readme.md
|
14
|
+
create zookeeper/CHANGELOG.md
|
15
|
+
create zookeeper/.gitignore
|
16
|
+
create zookeeper/main.tf
|
17
|
+
create zookeeper/outputs.tf
|
18
|
+
create zookeeper/variables.tf
|
19
|
+
create zookeeper/test
|
20
|
+
run git init zookeeper from "."
|
21
|
+
Initialized empty Git repository in /Users/zane/src/tfmod-generator/zookeeper/.git/
|
22
|
+
```
|
23
|
+
|
24
|
+
## Development
|
25
|
+
|
26
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
27
|
+
|
28
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
29
|
+
|
30
|
+
## Contributing
|
31
|
+
|
32
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/sepulworld/tfmod-generator. 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.
|
33
|
+
|
34
|
+
|
35
|
+
## License
|
36
|
+
|
37
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
38
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rake/testtask"
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'rubocop/rake_task'
|
6
|
+
RuboCop::RakeTask.new
|
7
|
+
rescue LoadError
|
8
|
+
puts 'Install "rubocop" to enable rubocop Rake task.'
|
9
|
+
end
|
10
|
+
|
11
|
+
Rake::TestTask.new(:test) do |t|
|
12
|
+
t.libs << "test"
|
13
|
+
t.libs << "lib"
|
14
|
+
t.test_files = FileList['test/**/*_test.rb']
|
15
|
+
end
|
16
|
+
|
17
|
+
task :default => :test
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "tfmod/generator"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/bin/tfmod
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'thor'
|
4
|
+
require 'tfmod/generator'
|
5
|
+
|
6
|
+
# Main class
|
7
|
+
class TfModule < Thor::Group
|
8
|
+
include Thor::Actions
|
9
|
+
|
10
|
+
argument :name
|
11
|
+
|
12
|
+
def self.source_root
|
13
|
+
File.dirname(__FILE__)
|
14
|
+
end
|
15
|
+
|
16
|
+
def create_readme_file
|
17
|
+
template('../templates/Readme.md.erb', "#{name}/Readme.md")
|
18
|
+
end
|
19
|
+
|
20
|
+
def create_changelog_file
|
21
|
+
template('../templates/CHANGELOG.md.erb', "#{name}/CHANGELOG.md")
|
22
|
+
end
|
23
|
+
|
24
|
+
def create_gitignore_file
|
25
|
+
template('../templates/gitignore.erb', "#{name}/.gitignore")
|
26
|
+
end
|
27
|
+
|
28
|
+
def create_main_tf_file
|
29
|
+
template('../templates/main.tf.erb', "#{name}/main.tf")
|
30
|
+
end
|
31
|
+
|
32
|
+
def create_outputs_tf_file
|
33
|
+
template('../templates/outputs.tf.erb', "#{name}/outputs.tf")
|
34
|
+
end
|
35
|
+
|
36
|
+
def create_variables_tf_file
|
37
|
+
template('../templates/variables.tf.erb', "#{name}/variables.tf")
|
38
|
+
end
|
39
|
+
|
40
|
+
def create_test_dir
|
41
|
+
empty_directory("#{name}/test")
|
42
|
+
end
|
43
|
+
|
44
|
+
def git_init
|
45
|
+
run("git init #{name}")
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
TfModule.start
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<%= name.capitalize %> Terraform module
|
2
|
+
===========
|
3
|
+
|
4
|
+
(Insert description of module here)
|
5
|
+
|
6
|
+
|
7
|
+
Module Input Variables
|
8
|
+
----------------------
|
9
|
+
|
10
|
+
- `tags` A map of tags that can be used for resource tagging and for naming must include, team, product, service, environment, owner. See usage example.
|
11
|
+
- `foo` A foo input
|
12
|
+
- `bar` A bar input
|
13
|
+
|
14
|
+
Usage
|
15
|
+
-----
|
16
|
+
|
17
|
+
```
|
18
|
+
module "<%= name %>" {
|
19
|
+
source = "git::ssh://git@github.com/tf/<%= name %>.git?ref=v0.0.1"
|
20
|
+
|
21
|
+
tags = {
|
22
|
+
team = "platform"
|
23
|
+
product = "silverbullet"
|
24
|
+
service = "<%= name %>"
|
25
|
+
environment = "dev"
|
26
|
+
owner = "insertyouremail@here.com"
|
27
|
+
}
|
28
|
+
|
29
|
+
addyourinputs = "more"
|
30
|
+
foo = "value"
|
31
|
+
bar = "VALIS"
|
32
|
+
}
|
33
|
+
```
|
34
|
+
|
35
|
+
Outputs
|
36
|
+
=======
|
37
|
+
|
38
|
+
- `example_1` - description of output
|
39
|
+
- `example_2` - description of output
|
@@ -0,0 +1 @@
|
|
1
|
+
// main tf file for <%= name.capitalize %>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'tfmod/generator/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "tfmod-generator"
|
8
|
+
spec.version = Tfmod::Generator::VERSION
|
9
|
+
spec.authors = ["zane"]
|
10
|
+
spec.email = ["zane.williamson@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Terraform module generator}
|
13
|
+
spec.description = %q{A Terraform module generator from command line.}
|
14
|
+
spec.homepage = "https://github.com/sepulworld/tfmod-generator"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
if spec.respond_to?(:metadata)
|
18
|
+
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
19
|
+
spec.metadata['optional_gems'] = "keyring"
|
20
|
+
end
|
21
|
+
|
22
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
23
|
+
f.match(%r{^(test|spec|features)/})
|
24
|
+
end
|
25
|
+
spec.bindir = "bin"
|
26
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
27
|
+
spec.require_paths = ["lib"]
|
28
|
+
|
29
|
+
spec.add_development_dependency "bundler", "~> 1.13"
|
30
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
31
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
32
|
+
spec.add_development_dependency 'rubocop', '~> 0'
|
33
|
+
|
34
|
+
spec.add_dependency "thor", "~> 0.19"
|
35
|
+
end
|
metadata
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tfmod-generator
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- zane
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-03-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.13'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.13'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '5.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '5.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubocop
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: thor
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.19'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.19'
|
83
|
+
description: A Terraform module generator from command line.
|
84
|
+
email:
|
85
|
+
- zane.williamson@gmail.com
|
86
|
+
executables:
|
87
|
+
- console
|
88
|
+
- setup
|
89
|
+
- tfmod
|
90
|
+
extensions: []
|
91
|
+
extra_rdoc_files: []
|
92
|
+
files:
|
93
|
+
- ".gitignore"
|
94
|
+
- ".travis.yml"
|
95
|
+
- CODE_OF_CONDUCT.md
|
96
|
+
- Gemfile
|
97
|
+
- LICENSE.txt
|
98
|
+
- README.md
|
99
|
+
- Rakefile
|
100
|
+
- bin/console
|
101
|
+
- bin/setup
|
102
|
+
- bin/tfmod
|
103
|
+
- lib/tfmod/generator.rb
|
104
|
+
- lib/tfmod/generator/version.rb
|
105
|
+
- templates/CHANGELOG.md.erb
|
106
|
+
- templates/Readme.md.erb
|
107
|
+
- templates/gitignore.erb
|
108
|
+
- templates/main.tf.erb
|
109
|
+
- templates/outputs.tf.erb
|
110
|
+
- templates/variables.tf.erb
|
111
|
+
- tfmod-generator.gemspec
|
112
|
+
homepage: https://github.com/sepulworld/tfmod-generator
|
113
|
+
licenses:
|
114
|
+
- MIT
|
115
|
+
metadata:
|
116
|
+
allowed_push_host: https://rubygems.org
|
117
|
+
optional_gems: keyring
|
118
|
+
post_install_message:
|
119
|
+
rdoc_options: []
|
120
|
+
require_paths:
|
121
|
+
- lib
|
122
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - ">="
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
127
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
requirements: []
|
133
|
+
rubyforge_project:
|
134
|
+
rubygems_version: 2.6.8
|
135
|
+
signing_key:
|
136
|
+
specification_version: 4
|
137
|
+
summary: Terraform module generator
|
138
|
+
test_files: []
|