tfwrapper 0.2.0.beta1 → 0.2.0
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/ChangeLog.md +5 -1
- data/README.md +1 -1
- data/lib/tfwrapper/version.rb +4 -2
- data/spec/acceptance/acceptance_spec.rb +67 -3
- data/spec/fixtures/testTwo/Rakefile +3 -0
- data/spec/fixtures/testTwo/foo/bar/testTwo.tf +0 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 546f4a0d5cfe06c3e1606071f6c09c74752d6ef0
|
4
|
+
data.tar.gz: 52178cde8c11eed2bed48df05c086ef9517d62c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 296ea36c9f2c02ebe4fed3b94bd69f3e47bb31f938980e8b96ff7d2528e1b2db63d9d9934394cb2a3fdb83bda0507cdaa238ec6425fe8830d4466c6097704fce
|
7
|
+
data.tar.gz: 4d2ac178cdd25438debf5add32f007f76d1ca99b23d04dfa29e26d90ef1d819c8ceb6172e6f4c93e09893daa1ca02ccb4fa2ae2dd1e70d9cab09b79baa0281c1
|
data/ChangeLog.md
CHANGED
data/README.md
CHANGED
data/lib/tfwrapper/version.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module TFWrapper
|
4
|
-
# version of the Gem/module; used in the gemspec and in messages
|
5
|
-
|
4
|
+
# version of the Gem/module; used in the gemspec and in messages.
|
5
|
+
# NOTE: When updating this, also update the version in the "Installation"
|
6
|
+
# section of README.md
|
7
|
+
VERSION = '0.2.0'
|
6
8
|
end
|
@@ -120,7 +120,10 @@ describe 'tfwrapper' do
|
|
120
120
|
)
|
121
121
|
ENV['FOO'] = 'fooval'
|
122
122
|
end
|
123
|
-
after(:all)
|
123
|
+
after(:all) do
|
124
|
+
ENV.delete('FOO')
|
125
|
+
ENV.delete('TFSUFFIX')
|
126
|
+
end
|
124
127
|
describe 'rake -T' do
|
125
128
|
before(:all) do
|
126
129
|
@out_err, @ecode = Open3.capture2e(
|
@@ -155,8 +158,69 @@ describe 'tfwrapper' do
|
|
155
158
|
expect(@out_err).to include('rake tf:write_tf_vars')
|
156
159
|
end
|
157
160
|
end
|
158
|
-
describe 'tf:apply' do
|
161
|
+
describe 'tf:apply foo' do
|
162
|
+
before(:all) do
|
163
|
+
Diplomat::Kv.get('/', keys: true).each { |k| Diplomat::Kv.delete(k) }
|
164
|
+
ENV['TFSUFFIX'] = 'foo'
|
165
|
+
@out_err, @ecode = Open3.capture2e(
|
166
|
+
'timeout -k 60 45 bundle exec rake tf:apply',
|
167
|
+
chdir: @fixturepath
|
168
|
+
)
|
169
|
+
@varpath = File.join(@fixturepath, 'build.tfvars.json')
|
170
|
+
end
|
171
|
+
after(:all) do
|
172
|
+
File.delete(@varpath) if File.file?(@varpath)
|
173
|
+
end
|
174
|
+
it 'does not time out' do
|
175
|
+
expect(@ecode.exitstatus).to_not eq(124)
|
176
|
+
expect(@ecode.exitstatus).to_not eq(137)
|
177
|
+
end
|
178
|
+
it 'exits zero' do
|
179
|
+
expect(@ecode.exitstatus).to eq(0)
|
180
|
+
end
|
181
|
+
it 'uses the correct Terraform version' do
|
182
|
+
expect(@out_err).to include("Terraform v#{TF_VERSION}")
|
183
|
+
end
|
184
|
+
it 'runs apply correctly and succeeds' do
|
185
|
+
expect(@out_err)
|
186
|
+
.to include('terraform_runner command: \'terraform apply -var-file')
|
187
|
+
expect(@out_err).to include('consul_keys.testTwo: Creating...')
|
188
|
+
expect(@out_err).to include(
|
189
|
+
'Apply complete! Resources: 1 added, 0 changed, 0 destroyed.'
|
190
|
+
)
|
191
|
+
expect(@out_err).to include(
|
192
|
+
"Outputs:\n\nbar_variable = barval\nfoo_variable = fooval"
|
193
|
+
)
|
194
|
+
end
|
195
|
+
it 'writes the vars file' do
|
196
|
+
expect(File.file?(@varpath)).to be(true)
|
197
|
+
c = File.open(@varpath, 'r').read
|
198
|
+
expect(JSON.parse(c))
|
199
|
+
.to eq('foo' => 'fooval', 'bar' => 'barval')
|
200
|
+
end
|
201
|
+
it 'sets the consul keys' do
|
202
|
+
expect(Diplomat::Kv.get('testTwo/foo')).to eq('fooval')
|
203
|
+
expect(Diplomat::Kv.get('testTwo/bar')).to eq('barval')
|
204
|
+
end
|
205
|
+
it 'writes remote state to consul' do
|
206
|
+
state = JSON.parse(Diplomat::Kv.get('terraform/testTwo/foo'))
|
207
|
+
expect(state['version']).to eq(3)
|
208
|
+
expect(state['terraform_version']).to eq(TF_VERSION)
|
209
|
+
expect(state['serial']).to eq(1)
|
210
|
+
expect(state['modules'].length).to eq(1)
|
211
|
+
expect(state['modules'][0]['outputs']['foo_variable']['value'])
|
212
|
+
.to eq('fooval')
|
213
|
+
expect(state['modules'][0]['outputs']['bar_variable']['value'])
|
214
|
+
.to eq('barval')
|
215
|
+
expect(state['modules'][0]['resources'])
|
216
|
+
.to include('consul_keys.testTwo')
|
217
|
+
expect(state['modules'][0]['resources'].length).to eq(1)
|
218
|
+
end
|
219
|
+
end
|
220
|
+
describe 'tf:apply bar' do
|
159
221
|
before(:all) do
|
222
|
+
Diplomat::Kv.get('/', keys: true).each { |k| Diplomat::Kv.delete(k) }
|
223
|
+
ENV['TFSUFFIX'] = 'bar'
|
160
224
|
@out_err, @ecode = Open3.capture2e(
|
161
225
|
'timeout -k 60 45 bundle exec rake tf:apply',
|
162
226
|
chdir: @fixturepath
|
@@ -198,7 +262,7 @@ describe 'tfwrapper' do
|
|
198
262
|
expect(Diplomat::Kv.get('testTwo/bar')).to eq('barval')
|
199
263
|
end
|
200
264
|
it 'writes remote state to consul' do
|
201
|
-
state = JSON.parse(Diplomat::Kv.get('terraform/testTwo'))
|
265
|
+
state = JSON.parse(Diplomat::Kv.get('terraform/testTwo/bar'))
|
202
266
|
expect(state['version']).to eq(3)
|
203
267
|
expect(state['terraform_version']).to eq(TF_VERSION)
|
204
268
|
expect(state['serial']).to eq(1)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tfwrapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.0
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jantman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: retries
|
@@ -393,9 +393,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
393
393
|
version: 2.0.0
|
394
394
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
395
395
|
requirements:
|
396
|
-
- - "
|
396
|
+
- - ">="
|
397
397
|
- !ruby/object:Gem::Version
|
398
|
-
version:
|
398
|
+
version: '0'
|
399
399
|
requirements: []
|
400
400
|
rubyforge_project:
|
401
401
|
rubygems_version: 2.5.2
|