terraform_landscape 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bd09d5f8db4155993cb141a7c3023a85ea510457a36c4eba4d7a0d87ed6aa4e5
4
- data.tar.gz: 7148ea8dd0ea53ff57ab5625202c6326f4c464fdc9d6cd2d8ef9902104697803
3
+ metadata.gz: 98a71818264c2488766b447e16abbd2be9eb743ddd8faf717df0b0652742ea36
4
+ data.tar.gz: 883c3799319b75efb960a6e185897a581d2362e4499c0f442dcf155669221d04
5
5
  SHA512:
6
- metadata.gz: 5bda7f64b4916b216438f5f5b9affcf1f39d0052939eacf45cfca55faf7c2b5b71bb917637887e22b75e7cc3119d26b0a040f8d253b6342a274294a719c91c71
7
- data.tar.gz: 433ad3a5df1022d2b8334a164334cfd0b44a3f627ea818ca37d130f6dbb4b8e30e452f03941fd054e7e8caccb378bc6387318939356320596966d482d2631f64
6
+ metadata.gz: d49d670112420768a487c6f69a009923a75607d8cfcc58beffa8824c96aec6ddd931a8c71b2281a69ea300558be4b05ce2058fb57b0ac1df101dac3e7fee0104
7
+ data.tar.gz: 42b90645cf8ab30928c2257afc11ebf943afe1216e9983f14c652808e8d22cd0a7b3cc9e988fa384b0158003696ed60b985b0b18959b7c2b80ff99497b574382
@@ -54,6 +54,12 @@ module TerraformLandscape
54
54
  # Remove separation lines that appear after refreshing state
55
55
  scrubbed_output.gsub!(/^-+$/, '')
56
56
 
57
+ if (matches = scrubbed_output.scan(/^Warning:.*$/))
58
+ matches.each do |warning|
59
+ @output.puts warning.colorize(:yellow)
60
+ end
61
+ end
62
+
57
63
  # Remove preface
58
64
  if (match = scrubbed_output.match(/^Path:[^\n]+/))
59
65
  scrubbed_output = scrubbed_output[match.end(0)..-1]
@@ -2,6 +2,7 @@ require 'colorize'
2
2
  require 'diffy'
3
3
  require 'json'
4
4
  require 'treetop'
5
+ require 'string_undump'
5
6
 
6
7
  ########################################################################
7
8
  # Represents the parsed output of `terraform plan`.
@@ -167,7 +168,8 @@ class TerraformLandscape::TerraformPlan # rubocop:disable Metrics/ClassLength
167
168
  end
168
169
  end
169
170
 
170
- def display_modified_attribute( # rubocop:disable Metrics/ParameterLists
171
+ # rubocop:disable Metrics/ParameterLists, Metrics/MethodLength
172
+ def display_modified_attribute(
171
173
  change_color,
172
174
  attribute_name,
173
175
  attribute_value,
@@ -175,12 +177,12 @@ class TerraformLandscape::TerraformPlan # rubocop:disable Metrics/ClassLength
175
177
  attribute_value_indent,
176
178
  attribute_value_indent_amount
177
179
  )
178
- # Since the attribute line is always of the form
179
- # "old value" => "new value", we can add curly braces and parse with
180
- # `eval` to obtain a hash with a single key/value.
181
- old, new = eval("{#{attribute_value}}").to_a.first # rubocop:disable Security/Eval
180
+ # Since the attribute line is always of the form "old value" => "new value"
181
+ attribute_value =~ /^ *(".*") *=> *(".*") *$/
182
+ old = Regexp.last_match[1].undump
183
+ new = Regexp.last_match[2].undump
182
184
 
183
- return if old == new # Don't show unchanged attributes
185
+ return if old == new && new != '<sensitive>' # Don't show unchanged attributes
184
186
 
185
187
  @out.print " #{attribute_name}:".ljust(attribute_value_indent_amount, ' ')
186
188
  .colorize(change_color)
@@ -217,7 +219,7 @@ class TerraformLandscape::TerraformPlan # rubocop:disable Metrics/ClassLength
217
219
  @out.print " #{attribute_name}:".ljust(attribute_value_indent_amount, ' ')
218
220
  .colorize(change_color)
219
221
 
220
- evaluated_string = eval(attribute_value) # rubocop:disable Security/Eval
222
+ evaluated_string = attribute_value.undump
221
223
  if json?(evaluated_string)
222
224
  @out.print to_pretty_json(evaluated_string).gsub("\n",
223
225
  "\n#{attribute_value_indent}")
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Defines the gem version.
4
4
  module TerraformLandscape
5
- VERSION = '0.2.1'.freeze
5
+ VERSION = '0.2.2'.freeze
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: terraform_landscape
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Coinbase
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-09-23 00:00:00.000000000 Z
12
+ date: 2018-11-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: colorize
@@ -53,6 +53,20 @@ dependencies:
53
53
  - - "~>"
54
54
  - !ruby/object:Gem::Version
55
55
  version: '3.0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: string_undump
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: 0.1.1
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: 0.1.1
56
70
  - !ruby/object:Gem::Dependency
57
71
  name: treetop
58
72
  requirement: !ruby/object:Gem::Requirement
@@ -106,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
120
  version: '0'
107
121
  requirements: []
108
122
  rubyforge_project:
109
- rubygems_version: 2.7.6
123
+ rubygems_version: 2.7.7
110
124
  signing_key:
111
125
  specification_version: 4
112
126
  summary: Pretty-print Terraform plan output