genesis_cli 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +24 -9
- data/lib/genesis/cli.rb +12 -15
- data/lib/genesis/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54b8056816b17f5845d43e79191065274e9c551f
|
4
|
+
data.tar.gz: f65b63927fe011a1695f3cd481a5cd24b57db216
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf762355a861eb64c8d06bb54ea8fdd2137ef694dbdbe051356c40280364a0c7facacbfab3e07b4be2b3314b21518012cc931eea8113bca414525915e261aa5a
|
7
|
+
data.tar.gz: 24f8d04099a353e78282aa1ee71baa562b07fef9c38c6688b3d3cfba55c1019ce36c6a22ab0d2bc048c2c6dd224a6a448653711868d6fe2d484c920d3c868e15
|
data/README.md
CHANGED
@@ -3,26 +3,41 @@ genesis [](https:
|
|
3
3
|
|
4
4
|
A Terraform CLI wrapper built by the Bandwidth Incubator.
|
5
5
|
|
6
|
-
Goals
|
6
|
+
#### Goals
|
7
|
+
|
7
8
|
1. Expose a command for each infrastructure-related lifecycle event in an Incubator-style project.
|
8
9
|
2. Each command should protect against accidental non-automated actions that impact infrastructure.
|
9
10
|
3. Don't do anything other than wrap the Terraform CLI
|
11
|
+
4. Be platform independent
|
12
|
+
|
13
|
+
Note: Still not tested on any OS other than Windows. Please submit an issue if there are problems!
|
10
14
|
|
11
15
|
This code base will be greatly simplified once Terraform allows for environment variable interpolation in ```tfvars``` files.
|
12
16
|
|
13
17
|
#### Installation
|
14
|
-
|
18
|
+
|
19
|
+
```gem install genesis```
|
15
20
|
|
16
21
|
#### Commands
|
17
|
-
- genesis apply
|
18
|
-
-
|
19
|
-
- genesis
|
20
|
-
-
|
21
|
-
- genesis
|
22
|
-
-
|
22
|
+
- genesis apply
|
23
|
+
- Apply infrastructure changes to match plan
|
24
|
+
- genesis destroy
|
25
|
+
- Destroy infrastructure Terraform knows about
|
26
|
+
- genesis help [COMMAND]
|
27
|
+
- Describe available commands or one specific command
|
28
|
+
- genesis plan
|
29
|
+
- Output an execution plan
|
30
|
+
- genesis refresh
|
31
|
+
- Reconcile state with the real-world infrastructure
|
32
|
+
- genesis show
|
33
|
+
- Output contents of the state file
|
34
|
+
|
35
|
+
Note:
|
36
|
+
> All of these commands assume that the current working directory contains a ```terraform``` directory where terraform ```tf```, ```tf.json```, and ```tfvars``` files are. This is the directory passed to the Terraform cli.
|
23
37
|
|
24
38
|
#### Options
|
25
|
-
- [--prompt], [--no-prompt]
|
39
|
+
- [--prompt], [--no-prompt]
|
40
|
+
- Prompt before executing dangerous commands (Default: true)
|
26
41
|
|
27
42
|
|
28
43
|
#### License
|
data/lib/genesis/cli.rb
CHANGED
@@ -52,17 +52,22 @@ module Genesis
|
|
52
52
|
default: true,
|
53
53
|
desc: 'Prompt before executing dangerous commands'
|
54
54
|
}
|
55
|
+
option :terraform_dir, {
|
56
|
+
default: File.join(Dir.pwd, 'terraform'),
|
57
|
+
desc: 'Directory where terraform files can be found'
|
58
|
+
}
|
55
59
|
def initialize(*args)
|
56
60
|
super
|
57
61
|
|
58
|
-
validate_environment_variables
|
59
|
-
validate_path
|
60
|
-
validate_terraform_directory
|
61
|
-
|
62
62
|
@aws_access_key = ENV['AWS_ACCESS_KEY']
|
63
63
|
@aws_secret_key = ENV['AWS_SECRET_KEY']
|
64
64
|
@aws_key_pair = ENV['AWS_KEY_PAIR']
|
65
65
|
@prompt = options[:prompt]
|
66
|
+
@terraform_dir = options[:terraform_dir]
|
67
|
+
|
68
|
+
validate_environment_variables
|
69
|
+
validate_path
|
70
|
+
validate_terraform_directory
|
66
71
|
end
|
67
72
|
|
68
73
|
private
|
@@ -98,7 +103,7 @@ module Genesis
|
|
98
103
|
|
99
104
|
def validate_terraform_directory
|
100
105
|
# Check that terraform directory is present
|
101
|
-
path = File.join(
|
106
|
+
path = File.join(@terraform_dir)
|
102
107
|
|
103
108
|
return if Dir.exist? path
|
104
109
|
|
@@ -106,20 +111,12 @@ module Genesis
|
|
106
111
|
exit(1)
|
107
112
|
end
|
108
113
|
|
109
|
-
def project_root
|
110
|
-
Dir.pwd
|
111
|
-
end
|
112
|
-
|
113
|
-
def terraform_dir
|
114
|
-
File.join(project_root, 'terraform')
|
115
|
-
end
|
116
|
-
|
117
114
|
def state_file
|
118
|
-
File.join(terraform_dir, 'terraform.tfstate')
|
115
|
+
File.join(@terraform_dir, 'terraform.tfstate')
|
119
116
|
end
|
120
117
|
|
121
118
|
def plan_file
|
122
|
-
File.join(terraform_dir, 'terraform.tfplan')
|
119
|
+
File.join(@terraform_dir, 'terraform.tfplan')
|
123
120
|
end
|
124
121
|
end
|
125
122
|
end
|
data/lib/genesis/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: genesis_cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tyler Cross
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|