terraform_landscape 0.1.1 → 0.1.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
  SHA1:
3
- metadata.gz: 873268f2146c91ce61b536b6db5cad75c838a57e
4
- data.tar.gz: e72bcc88f82d59be0d6e4ccbc5ffff9647e66ad1
3
+ metadata.gz: d41f446c190ff599a75b12d4bedd7efaeb2ca8d1
4
+ data.tar.gz: 4a9a397f85381666a3350a3ec78e98c222b9a4ef
5
5
  SHA512:
6
- metadata.gz: e6d9de73a88d69195126cc63316f8bcb89a8686c1cc82f21f38c11f26ba2a9d1be9da0623ab30553b2659ec65456b26020d55ce803a94c54bea470a97dcb0c67
7
- data.tar.gz: b6c463f56c90166e9e7f77332c36d2d782571ea7724e0970e25e0d8501861357ba73f0fa8ea01fb149b0d30e1c0ff6cff42128169635fc767bf06e0ecb700540
6
+ metadata.gz: db539abe27265275f2d7261c7219a6580044821e2fd6feecd1fd05ff2ab06f70fe180fe60389c7b3a2a5fd6eaa90aabf32b3a0c59b73c857ab197807b0e95160
7
+ data.tar.gz: 5f008c8351cbe25da8b90e0dfe09ea9104ce9eb5f55832c4f22cb9a0bbcc5e2ad5469399befcb6488e464c2b039954833f40e873b79f72ed9d476bce0613e048
@@ -38,9 +38,24 @@ grammar TerraformPlan
38
38
  end
39
39
 
40
40
  rule resource_header
41
- change:('~' / '-' / '+') _ type:[a-zA-Z0-9_-]+ '.' name:[a-zA-Z0-9_-]+ {
41
+ change:('~' / '-/+' / '-' / '+') _ type:[a-zA-Z0-9_-]+ '.' name:[a-zA-Z0-9_-]+ _ '(' reason:[^)]+ ')' {
42
42
  def to_ast
43
- { change: change.text_value.to_sym, resource_type: type.text_value, resource_name: name.text_value }
43
+ {
44
+ change: change.text_value.to_sym,
45
+ resource_type: type.text_value,
46
+ resource_name: name.text_value,
47
+ reason: reason.text_value,
48
+ }
49
+ end
50
+ }
51
+ /
52
+ change:('~' / '-/+' / '-' / '+') _ type:[a-zA-Z0-9_-]+ '.' name:[a-zA-Z0-9_-]+ {
53
+ def to_ast
54
+ {
55
+ change: change.text_value.to_sym,
56
+ resource_type: type.text_value,
57
+ resource_name: name.text_value,
58
+ }
44
59
  end
45
60
  }
46
61
  end
@@ -17,7 +17,8 @@ class TerraformLandscape::TerraformPlan
17
17
  CHANGE_SYMBOL_TO_COLOR = {
18
18
  :~ => :yellow,
19
19
  :- => :red,
20
- :+ => :green
20
+ :+ => :green,
21
+ :'-/+' => :yellow
21
22
  }.freeze
22
23
 
23
24
  DEFAULT_DIFF_CONTEXT_LINES = 5
@@ -62,8 +63,11 @@ class TerraformLandscape::TerraformPlan
62
63
  def display_resource(resource)
63
64
  change_color = CHANGE_SYMBOL_TO_COLOR[resource[:change]]
64
65
 
65
- @out.puts "#{resource[:change]} #{resource[:resource_type]}." \
66
- "#{resource[:resource_name]}".colorize(change_color)
66
+ resource_header = "#{resource[:change]} #{resource[:resource_type]}." \
67
+ "#{resource[:resource_name]}".colorize(change_color)
68
+ resource_header += " (#{resource[:reason]})" if resource[:reason]
69
+
70
+ @out.puts resource_header
67
71
 
68
72
  # Determine longest attribute name so we align all values at same indentation
69
73
  attribute_value_indent_amount = attribute_indent_amount_for_resource(resource)
@@ -115,7 +119,7 @@ class TerraformLandscape::TerraformPlan
115
119
  )
116
120
  attribute_value_indent = ' ' * attribute_value_indent_amount
117
121
 
118
- if resource[:change] == :~
122
+ if [:~, :'-/+'].include?(resource[:change])
119
123
  display_modified_attribute(change_color,
120
124
  attribute_name,
121
125
  attribute_value,
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Defines the gem version.
4
4
  module TerraformLandscape
5
- VERSION = '0.1.1'.freeze
5
+ VERSION = '0.1.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.1.1
4
+ version: 0.1.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: 2017-03-16 00:00:00.000000000 Z
12
+ date: 2017-03-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: colorize