tfwrapper 0.6.2 → 0.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4a404a81c05bcc07e29ef34eef1d881aa9c47faa1e5ba0ed127a34b8ae1202c5
4
- data.tar.gz: f0078c62815fd5d7e49c14d201d9da2154ed91f6c4786a7a7be65914582cd4d8
3
+ metadata.gz: d800160edbaa04ea415c64a6153496bc11ac26134f37cdec619ad79f1ac790f7
4
+ data.tar.gz: 3052aaa38b88c2faaebbbe3e924d693eb2acfed70ed5ea9f201bd1eeebbe8921
5
5
  SHA512:
6
- metadata.gz: db129accb7e439c570ca8a8eb2d56a259acb98221a5acf5e451cc4aa44516627abd6e29603574abbf4dcd16c968b58607552bbec3a1b50ce7df44de9659968a7
7
- data.tar.gz: f9f99bcc2e51e2aa4cedabd0e1179a1954dbc3e3e4d44149ab2d171218cc6e55a940ef2372869c6cd694c77be0282d5230f7a7d142eaea53479794c78550e810
6
+ metadata.gz: 2927add435fcb35ff775884b748a5c1e2ab3c5ae8ab3766dd53c32cae56dcbaba33c80d7d5e39a94133bdad9bb822c32a81bc2c58627872e795fd818c5e151fa
7
+ data.tar.gz: 2510df4efa55b5f7c304c073afea722ef85a22218c8ad8b6374a4c2f8ca5d903de926be3a4218f7c49e4c6c1a51b05a5c40197f602e8b370e7a4dc4087428245
@@ -1,3 +1,7 @@
1
+ Version 0.6.3
2
+
3
+ - Fix bug with ``tf_sensitive_vars``. Prevent values from being printed in ``update_consul_stack_env_vars``.
4
+
1
5
  Version 0.6.2
2
6
 
3
7
  - Add ``tf_sensitive_vars`` option.
data/README.md CHANGED
@@ -345,7 +345,7 @@ require 'tfwrapper/raketasks'
345
345
 
346
346
  TFWrapper::RakeTasks.install_tasks(
347
347
  '.',
348
- tf_vars_from_env: {'foo' => 'FOO', 'bar' => 'BAR', 'secret' => 'abc'},
348
+ tf_vars_from_env: {'foo' => 'FOO', 'bar' => 'BAR', 'secret' => 'SECRET'},
349
349
  tf_sensitive_vars: ['secret']
350
350
  )
351
351
  ```
@@ -468,7 +468,16 @@ module TFWrapper
468
468
 
469
469
  puts "Writing stack information to #{@consul_url} at: "\
470
470
  "#{@consul_env_vars_prefix}"
471
- puts JSON.pretty_generate(data)
471
+
472
+ redacted_list = (%w[aws_access_key aws_secret_key] +
473
+ @tf_sensitive_vars)
474
+ sanitized_data = data.clone
475
+ @tf_vars_from_env.each do |k, v|
476
+ # We are trying to determine which ENV var maps
477
+ # to the sensitive terraform variable
478
+ sanitized_data[v] = '(redacted)' if redacted_list.include?(k)
479
+ end
480
+ puts JSON.pretty_generate(sanitized_data)
472
481
  raw = JSON.generate(data)
473
482
  Diplomat::Kv.put(@consul_env_vars_prefix, raw)
474
483
  end
@@ -4,5 +4,5 @@ module TFWrapper
4
4
  # version of the Gem/module; used in the gemspec and in messages.
5
5
  # NOTE: When updating this, also update the version in the "Installation"
6
6
  # section of README.md
7
- VERSION = '0.6.2'
7
+ VERSION = '0.6.3'
8
8
  end
@@ -1421,21 +1421,28 @@ describe TFWrapper::RakeTasks do
1421
1421
  describe '#update_consul_stack_env_vars' do
1422
1422
  context 'when @consul_url and @consul_env_vars_prefix are specified' do
1423
1423
  it 'saves the variables in Consul' do
1424
- vars = { 'foo' => 'bar', 'baz' => 'blam' }
1425
- expected = { 'bar' => 'barVal', 'blam' => 'blamVal' }
1424
+ vars = { 'foo' => 'bar', 'baz' => 'blam', 'secret' => 'SECRET' }
1425
+ expected = { 'bar' => 'barVal',
1426
+ 'blam' => 'blamVal',
1427
+ 'SECRET' => 'abc' }
1428
+ sanitized = { 'bar' => 'barVal',
1429
+ 'blam' => 'blamVal',
1430
+ 'SECRET' => '(redacted)' }
1426
1431
  subject.instance_variable_set('@tf_vars_from_env', vars)
1427
1432
  subject.instance_variable_set('@consul_url', 'foo://bar')
1428
1433
  subject.instance_variable_set('@consul_env_vars_prefix', 'my/prefix')
1434
+ subject.instance_variable_set('@tf_sensitive_vars', ['secret'])
1429
1435
  allow(ENV).to receive(:[])
1430
1436
  allow(ENV).to receive(:[]).with('CONSUL_HOST').and_return('chost')
1431
1437
  allow(ENV).to receive(:[]).with('bar').and_return('barVal')
1432
1438
  allow(ENV).to receive(:[]).with('blam').and_return('blamVal')
1439
+ allow(ENV).to receive(:[]).with('SECRET').and_return('abc')
1433
1440
  allow(Diplomat::Kv).to receive(:put)
1434
1441
 
1435
1442
  expect(STDOUT).to receive(:puts).once
1436
1443
  .with('Writing stack information to foo://bar at: my/prefix')
1437
1444
  expect(STDOUT).to receive(:puts).once
1438
- .with(JSON.pretty_generate(expected))
1445
+ .with(JSON.pretty_generate(sanitized))
1439
1446
  expect(Diplomat::Kv).to receive(:put)
1440
1447
  .once.with('my/prefix', JSON.generate(expected))
1441
1448
  subject.update_consul_stack_env_vars
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.6.2
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - jantman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-17 00:00:00.000000000 Z
11
+ date: 2020-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: retries