cfhighlander 0.12.0 → 0.12.1.alpha.1589238004

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: 894cac0fd48e60d1b3a8f36bae4d025ef6faeb71f3477287105b7eb5a7d673e0
4
- data.tar.gz: 2754a30993473d481129988618627e3565f7f5a42ff5f22b96263912c0c21026
3
+ metadata.gz: e0a790344ca30bc58633601d8d0b9b8eede6b69663fa149405f7162ceb1e1b5b
4
+ data.tar.gz: 0aa482c8e3f726b92ef291216b68bf56acad55ffa764dc0e41575ef220e6b334
5
5
  SHA512:
6
- metadata.gz: 064b05d3f42885aa55cb0563cd24368dc51972bc4be2d58f7fd985591dc9a66a1609639cb32cc46e217ea2be6738af74a0d46dacb14e66f6ffb941002d74ec53
7
- data.tar.gz: 4e34ed01686c18a29e91934311b0a4fb47fb327859e67a69dc0c2c9ad123ca4e9d2d5f1fdaea2f6c2cdeb70a7801deb34d5724d43a58d2f5f787568662e1304a
6
+ metadata.gz: '030590a7fb1d3bfa411349b7fc2fb37c9806825ce6e6ac557b3052194691a5d496ac594de74ffa4eecc6f56537d7593a84ffcd8a65e974f990feb65cf642756a'
7
+ data.tar.gz: 91d9168c855c70fa0c34caf4bb7c6f6deae7b8e85615647f36f8e20fb5b10bc82e05b37835379d0f1fdbbedb0ea97ded3987e9cf7f4eb7d5d9c8a39bc46f58c5
data/README.md CHANGED
@@ -448,7 +448,9 @@ end
448
448
 
449
449
  **Conditional components** - If you want to add top level paramater as feature toggle for one of the inner
450
450
  components, just mark it as conditional, using `conditional:` named parameter. In addition to this, default
451
- value for feature toggle can be supplied using `enabled:` named parameter
451
+ value for feature toggle can be supplied using `enabled:` named parameter. Autogenerated parameter will be named
452
+ `Enable$COMPONENTNAME`, defaulting to `[true,false]` as set of allowed values. Autogenerated condition will
453
+ be named same as parameter, and checking if the parameter value equlas `true`
452
454
 
453
455
 
454
456
  ```ruby
@@ -469,16 +471,23 @@ end
469
471
 
470
472
  ```
471
473
 
472
- **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.
474
+ **Override default behaviour** - If you have more than 1 stack you want to control with a single parameter, or you want to change
475
+ parameter name, you can supply the `condition:` option with a string value on each component you want to control with the condition.
476
+ Autogenerated condition can be overriden as well, by defining your own condition with the same name on the highlander
477
+ template, as in example below.
478
+
473
479
 
474
480
  ```ruby
475
481
  CfhighlanderTemplate do
476
482
 
483
+ # [Optional - Define your own condition, instead of default true/false one]
484
+ Condition 'EnableDevelopmentResources', FnEquals(Ref(:EnvironmentName),'dev')
485
+
477
486
  # Components always required
478
487
  Component 'vpc'
479
488
  Component name: 'ecs', template: 'ecs'
480
489
 
481
- # Components only required in development environments
490
+ # Components only required in development environments with common condition name
482
491
  Component name: 'linux-bastion', template: 'bastion', conditional: true, condition: 'EnableDevelopmentResources', enabled: false
483
492
  Component name: 'windows-bastion', template: 'bastion', conditional: true, condition: 'EnableDevelopmentResources', enabled: false
484
493
 
@@ -95,12 +95,15 @@ module Cfhighlander
95
95
  if @conditional
96
96
  condition = "Enable#{@cfn_name}" if @condition.nil?
97
97
  @condition = condition
98
- @parent.Condition(condition, CfnDsl::Fn.new('Equals', [
99
- CfnDsl::RefDefinition.new(condition),
100
- 'true'
101
- ]).to_json)
102
- @parent.Parameters do
103
- ComponentParam condition, enabled.to_s, allowedValues: %w(true false)
98
+ parent_condition_defined = @parent.conditions.find {|c| c.name == @condition}
99
+ unless parent_condition_defined
100
+ @parent.Condition(condition, CfnDsl::Fn.new('Equals', [
101
+ CfnDsl::RefDefinition.new(condition),
102
+ 'true'
103
+ ]).to_json)
104
+ @parent.Parameters do
105
+ ComponentParam condition, enabled.to_s, allowedValues: %w(true false)
106
+ end
104
107
  end
105
108
  end
106
109
  end
@@ -1,3 +1,3 @@
1
1
  module Cfhighlander
2
- VERSION="0.12.0".freeze
2
+ VERSION="0.12.1".freeze
3
3
  end
@@ -17,7 +17,7 @@ CloudFormation do
17
17
  CloudFormation_Stack('<%= @subcomponent.cfn_name %>') do
18
18
  TemplateURL '<%= @subcomponent.distribution_url %>'
19
19
  <%- if !@subcomponent.dependson.empty? %>
20
- DependsOn <%= @subcomponent.dependson %>
20
+ DependsOn <%= @subcomponent.dependson %>
21
21
  <%- end %>
22
22
  Parameters ({
23
23
  <% for @param in @subcomponent.parameters %><%="\t"%>'<%=@param.name %>' => <%= @param.cfndsl_value %>,
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.12.0
4
+ version: 0.12.1.alpha.1589238004
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: 2020-04-12 00:00:00.000000000 Z
13
+ date: 2020-05-11 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: highline
@@ -277,9 +277,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
277
277
  version: '0'
278
278
  required_rubygems_version: !ruby/object:Gem::Requirement
279
279
  requirements:
280
- - - ">="
280
+ - - ">"
281
281
  - !ruby/object:Gem::Version
282
- version: '0'
282
+ version: 1.3.1
283
283
  requirements: []
284
284
  rubyforge_project:
285
285
  rubygems_version: 2.7.7