cfhighlander 0.12.0.alpha.1586689671 → 0.12.2.alpha.1603234673

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: 0a2621ce04b1a08e7d4d77c8412f98fe7866ccb58c78b76ce9788f323c80a9ae
4
- data.tar.gz: 3bf4fe4646e24230d0fb7e6dc09730eb5694b2346376e60d95e1251ddff6c104
3
+ metadata.gz: d536f8e52032ab314218ebc97602337ce9641674dc922162e5edd0bf85fc1c45
4
+ data.tar.gz: 6c8b11170fd53dd05101febff9805875bd09ef7ef978d045231d42d036179330
5
5
  SHA512:
6
- metadata.gz: 6ebcc02c712f281750604d4d875b684de9390d05a4f420ce49657d2fe33d2bc56aef1fac361bb084be4e4a2a27f03c6b26fe977b426e6c606f417a4e825ece34
7
- data.tar.gz: dd8d65d96c1790deea973f5b2a89b3150065353f932f1e65bbeb61b515d37e1928edced90626b16072a399cacea2e4115c842d86fa94e745921f770702541944
6
+ metadata.gz: 262fa6c520fbf222e38a3a6d6213fd5999774d06eb6b9dbb5cba02a353338a3638ccecf9afdb5abcb77c7d4f99dca2b3d732d893aea65d39dbd2df36d89ff404
7
+ data.tar.gz: 391b8f33fe0da950823abb6286116612c900a62cc273e9114bb2915cad42764b74459b8efd623a91035ce2531c9d139de96c750e471216899c6b3a49073d978c
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
 
@@ -486,6 +495,17 @@ CfhighlanderTemplate do
486
495
  end
487
496
  ```
488
497
 
498
+ **Nested Stack Timeout** - If you ant set a timeout on your nested cloudformation stack you can set this with the `timeout: int` option on the component.
499
+
500
+ ```ruby
501
+ CfhighlanderTemplate do
502
+
503
+ # sets a timeout for 10 minutes on the nested VPC stack, if the stack is not created or updated within 10 minutes the stack rolls back.
504
+ Component name: 'vpc', template: 'vpc-v2', timeout: 10
505
+
506
+ end
507
+ ```
508
+
489
509
  **Convert config value to parameter** - In case of inner component having configuration value
490
510
  you wish to expose as runtime parameter, it is possible to do so with limitation that configuration
491
511
  value is only used in *resource declarations*, as property value. If configuration value is being used
@@ -36,7 +36,8 @@ module Cfhighlander
36
36
  :template_version,
37
37
  :inlined,
38
38
  :dependson,
39
- :condition
39
+ :condition,
40
+ :template_timeout
40
41
 
41
42
  def initialize(parent,
42
43
  name,
@@ -49,6 +50,7 @@ module Cfhighlander
49
50
  condition = nil,
50
51
  enabled = true,
51
52
  dependson = [],
53
+ template_timeout = nil,
52
54
  inline = false,
53
55
  distribution_format = 'yaml')
54
56
 
@@ -59,6 +61,7 @@ module Cfhighlander
59
61
  @conditional = conditional
60
62
  @condition = condition
61
63
  @dependson = [*dependson]
64
+ @template_timeout = template_timeout
62
65
  @inlined = inline
63
66
 
64
67
  template_name = template
@@ -95,12 +98,15 @@ module Cfhighlander
95
98
  if @conditional
96
99
  condition = "Enable#{@cfn_name}" if @condition.nil?
97
100
  @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)
101
+ parent_condition_defined = @parent.conditions.find {|c| c.name == @condition}
102
+ unless parent_condition_defined
103
+ @parent.Condition(condition, CfnDsl::Fn.new('Equals', [
104
+ CfnDsl::RefDefinition.new(condition),
105
+ 'true'
106
+ ]).to_json)
107
+ @parent.Parameters do
108
+ ComponentParam condition, enabled.to_s, allowedValues: %w(true false)
109
+ end
104
110
  end
105
111
  end
106
112
  end
@@ -151,13 +157,12 @@ module Cfhighlander
151
157
  param_ovr[:maxValue] = maxValue unless maxValue.nil?
152
158
  param_ovr[:minLength] = minLength unless minLength.nil?
153
159
  param_ovr[:minValue] = minValue unless minValue.nil?
154
-
155
160
  @component_loaded.highlander_dsl.Parameters do
156
161
  ComponentParam name, value, param_ovr
157
162
  end
158
163
  else
159
164
  parameter.default_value = defaultValue unless defaultValue.nil?
160
- parameter.type unless type.nil?
165
+ parameter.type = type unless type.nil?
161
166
  parameter.no_echo = noEcho unless noEcho.nil?
162
167
  parameter.allowed_values = allowedValues unless allowedValues.nil?
163
168
  parameter.allowed_pattern = allowedPattern unless allowedPattern.nil?
@@ -37,7 +37,8 @@ module Cfhighlander
37
37
  :lambda_functions_keys,
38
38
  :description,
39
39
  :dependson_components,
40
- :template_dir
40
+ :template_dir,
41
+ :template_timeout
41
42
 
42
43
  attr_reader :conditions,
43
44
  :subcomponents,
@@ -57,6 +58,7 @@ module Cfhighlander
57
58
  @lambda_functions_keys = []
58
59
  @dependson_components_templates = []
59
60
  @dependson_components = []
61
+ @template_timeout = nil
60
62
  @conditions = []
61
63
  @config_overrides = {}
62
64
  @extended_template = nil
@@ -127,6 +129,7 @@ module Cfhighlander
127
129
  condition: nil,
128
130
  enabled: true,
129
131
  dependson: [],
132
+ timeout: nil,
130
133
  render: Cfhighlander::Model::Component::Substack,
131
134
  &block)
132
135
  puts "INFO: Requested subcomponent #{name} with template #{template}"
@@ -151,6 +154,7 @@ module Cfhighlander
151
154
  condition,
152
155
  enabled,
153
156
  dependson,
157
+ timeout,
154
158
  render == Cfhighlander::Model::Component::Inline
155
159
  )
156
160
  # component.instance_eval(&block) unless block.nil?
@@ -1,3 +1,3 @@
1
1
  module Cfhighlander
2
- VERSION="0.12.0".freeze
2
+ VERSION="0.12.2".freeze
3
3
  end
@@ -17,12 +17,15 @@ 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 %>,
24
24
  <% end %>})
25
25
  <% if @subcomponent.conditional %>Condition '<%= @subcomponent.condition %>' <% end %>
26
+ <%- if !@subcomponent.template_timeout.nil? %>
27
+ TimeoutInMinutes <%= @subcomponent.template_timeout.to_i %>
28
+ <%- end %>
26
29
  end
27
30
  <% end %>
28
31
 
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.alpha.1586689671
4
+ version: 0.12.2.alpha.1603234673
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-10-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: highline
@@ -281,8 +281,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
281
281
  - !ruby/object:Gem::Version
282
282
  version: 1.3.1
283
283
  requirements: []
284
- rubyforge_project:
285
- rubygems_version: 2.7.7
284
+ rubygems_version: 3.0.8
286
285
  signing_key:
287
286
  specification_version: 4
288
287
  summary: DSL on top of cfndsl. Manage libraries of cloudformation components