cfhighlander 0.10.3 → 0.10.4.alpha.1575543782

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: 5341cd777b7476fa015310b05c21a8814a7704bdca030f8e8e08da63d1b59bca
4
- data.tar.gz: ae5211c48c47d1eedc1a4c18c5f657f0115d5301407ff41cd6557510d1bc41a5
3
+ metadata.gz: 6429727b671be259b4a45e5eb2866e8048e82a50e3ab0081895f8c138271f7f9
4
+ data.tar.gz: ca62164af33efebd992e34f37ba0212c7bc6c35632d6f00eefbda22b894a2fbc
5
5
  SHA512:
6
- metadata.gz: 4e6f5ed07efe88049cd6966c5fc8ed1da5f2fabf3de13cc03863ea3570584ea12f60ca3aadc6e2de57cd9581fcf3ea83fd928f658a034f54229dd7da032d2e7c
7
- data.tar.gz: 9607ee7a04fc925f40298cecdb38f4a62c34d5f9e8c3db9ecc7932a2856cec1d26db3767d682428e9f935a600197cf536490e14b15df594d0fed639a88806ab5
6
+ metadata.gz: ab5e6cbf9f210fde2970436a595e47bac2fbb7e4088f133420fa3863f41ef5302a2ef5bb1a82bbc3872dc36f04715aaa61266dbd2d331eb04c3fb89ee8e9d780
7
+ data.tar.gz: c8ec94cc3f5420300639a9850176cf6eeca3b2820bed5027751895b55b1d819eb3b06a697fdf7d5c745e712d22e0b22c3e359726e85ef369cb6a9d829068aec4
data/README.md CHANGED
@@ -459,6 +459,23 @@ end
459
459
 
460
460
  ```
461
461
 
462
+ **Conditional Groups** - If you have more than 1 stack you want to control with a single parameter, you can supply the `condition:` option with a string value on each component you want to control with the condition.
463
+
464
+ ```ruby
465
+ CfhighlanderTemplate do
466
+
467
+ # Components always required
468
+ Component 'vpc'
469
+ Component name: 'ecs', template: 'ecs'
470
+
471
+ # Components only required in development environments
472
+ Component name: 'linux-bastion', template: 'bastion', conditional: true, condition: 'EnableDevelopmentResources', enabled: false
473
+ Component name: 'windows-bastion', template: 'bastion', conditional: true, condition: 'EnableDevelopmentResources', enabled: false
474
+
475
+
476
+ end
477
+ ```
478
+
462
479
  **Convert config value to parameter** - In case of inner component having configuration value
463
480
  you wish to expose as runtime parameter, it is possible to do so with limitation that configuration
464
481
  value is only used in *resource declarations*, as property value. If configuration value is being used
@@ -35,8 +35,9 @@ module Cfhighlander
35
35
  :template,
36
36
  :template_version,
37
37
  :inlined,
38
- :dependson
39
-
38
+ :dependson,
39
+ :condition
40
+
40
41
  def initialize(parent,
41
42
  name,
42
43
  template,
@@ -45,6 +46,7 @@ module Cfhighlander
45
46
  config = {},
46
47
  export_config = {},
47
48
  conditional = false,
49
+ condition = nil,
48
50
  enabled = true,
49
51
  dependson = [],
50
52
  inline = false,
@@ -55,6 +57,7 @@ module Cfhighlander
55
57
  @export_config = export_config
56
58
  @component_sources = component_sources
57
59
  @conditional = conditional
60
+ @condition = condition
58
61
  @dependson = [*dependson]
59
62
  @inlined = inline
60
63
 
@@ -90,13 +93,13 @@ module Cfhighlander
90
93
 
91
94
  # add condition to parent if conditonal component
92
95
  if @conditional
93
- condition_param_name = "Enable#{@cfn_name}"
94
- @parent.Condition(condition_param_name, CfnDsl::Fn.new('Equals', [
95
- CfnDsl::RefDefinition.new(condition_param_name),
96
+ condition_name = @condition.nil? ? "Enable#{@cfn_name}" : @condition
97
+ @parent.Condition(condition_name, CfnDsl::Fn.new('Equals', [
98
+ CfnDsl::RefDefinition.new(condition_name),
96
99
  'true'
97
100
  ]).to_json)
98
101
  @parent.Parameters do
99
- ComponentParam condition_param_name, enabled.to_s, allowedValues: %w(true false)
102
+ ComponentParam condition_name, enabled.to_s, allowedValues: %w(true false)
100
103
  end
101
104
  end
102
105
  end
@@ -117,6 +117,7 @@ module Cfhighlander
117
117
  config: {},
118
118
  export_config: {},
119
119
  conditional: false,
120
+ condition: nil,
120
121
  enabled: true,
121
122
  dependson: [],
122
123
  render: Cfhighlander::Model::Component::Substack,
@@ -140,6 +141,7 @@ module Cfhighlander
140
141
  config,
141
142
  export_config,
142
143
  conditional,
144
+ condition,
143
145
  enabled,
144
146
  dependson,
145
147
  render == Cfhighlander::Model::Component::Inline
@@ -1,3 +1,3 @@
1
1
  module Cfhighlander
2
- VERSION="0.10.3".freeze
2
+ VERSION="0.10.4".freeze
3
3
  end
@@ -17,7 +17,7 @@ CloudFormation do
17
17
  Parameters ({
18
18
  <% for @param in @subcomponent.parameters %><%="\t"%>'<%=@param.name %>' => <%= @param.cfndsl_value %>,
19
19
  <% end %>})
20
- <% if @subcomponent.conditional %>Condition 'Enable<%= @subcomponent.cfn_name %>' <% end %>
20
+ <% if @subcomponent.conditional %>Condition '<%= @subcomponent.condition %>' <% end %>
21
21
  end
22
22
  <% end %>
23
23
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cfhighlander
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.3
4
+ version: 0.10.4.alpha.1575543782
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nikola Tosic
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2019-11-13 00:00:00.000000000 Z
13
+ date: 2019-12-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: highline
@@ -271,9 +271,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
271
271
  version: '0'
272
272
  required_rubygems_version: !ruby/object:Gem::Requirement
273
273
  requirements:
274
- - - ">="
274
+ - - ">"
275
275
  - !ruby/object:Gem::Version
276
- version: '0'
276
+ version: 1.3.1
277
277
  requirements: []
278
278
  rubyforge_project:
279
279
  rubygems_version: 2.7.7