cfhighlander 0.10.7 → 0.10.8.alpha.1582708349

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: e1da99a1d678b6b91cccc949d2586a42775346c9e10e84b2045d560adccfafd3
4
- data.tar.gz: 5bf57aa759886f52450a2c98ad0f4408d4d1fa4b1c348da2cff2c14f28601db9
3
+ metadata.gz: 81ea5de47811b5292478483603cf5ab59bb115f9dfe3f3a851d655c2c98eb105
4
+ data.tar.gz: b706aae6e5ecf53293a4f70d3cd1add5c024eced73bdfa396e740e979e5a30f2
5
5
  SHA512:
6
- metadata.gz: 1990a192aa56820f49cbc4519a9214dd894587060fe9b833ad1f55c337c5a1ac0fe48bd29991caf5cf308050c639c1c340ec30e35888f60539065a2af498c8f3
7
- data.tar.gz: '0963a8b1eb0f42350e1523cde9e373adfb6b2fb74215655b312a875d1792121b5149b2bee8d84fddab37cb3454f704bbe8355d904b630444fbbf360bd8daf5ed'
6
+ metadata.gz: 63155d443df716a879d714b9a5b64d535d41649769db0a507bffcb4928b3cdd5de8475617ffdf2828ac8dc13f514c0a07d4cab5dcb373203af8f409bba45f221
7
+ data.tar.gz: cb65a4d8789096c3fa28f78f4ee0f4d3b679bd5ba52c2cbac85e2f7ea2fdfc64f8b87138cec64511da32f819ed0bbc567ec356cdaf61bec664d87cfa2511aac8
data/README.md CHANGED
@@ -967,6 +967,26 @@ test_metadata:
967
967
  description: Create 2 queues with name and override available config
968
968
  ```
969
969
 
970
+ ### Test Paramaters
971
+
972
+ If you want to test a component with a parameter input you can specify the `test-parameters:` key with key:value pairs of parameters
973
+
974
+ ```yaml
975
+ # Define the test parameter
976
+ test_parameters:
977
+ SecurityGroupId: sg-123456789
978
+
979
+ # Test configuration
980
+ security_group_rules:
981
+ -
982
+ from: 22
983
+ protocol: tcp
984
+ security_group_id:
985
+ # use the parameter within our test
986
+ Ref: SecurityGroupId
987
+ desc: ssh access from another security group
988
+ ```
989
+
970
990
  ### Running Test
971
991
 
972
992
  ```bash
data/bin/cfhighlander.rb CHANGED
@@ -214,6 +214,10 @@ class HighlanderCli < Thor
214
214
  puts "INFO: Reloading component, as auto-generated distribution settings are being applied..."
215
215
  component.load
216
216
  end if autogenerate_dist
217
+
218
+ test[:test_parameters].each do |name,value|
219
+ component.highlander_dsl.parameters.ComponentParam(name,value)
220
+ end
217
221
 
218
222
  # compile cloud formation
219
223
  component_compiler = Cfhighlander::Compiler::ComponentCompiler.new(component)
@@ -86,6 +86,10 @@ module Cfhighlander
86
86
  sc.distribution_format = out_format
87
87
  }
88
88
 
89
+ # figure out cfndsl version
90
+ cfndsl_version = CfnDsl::VERSION
91
+ legacy_cfndsl = cfndsl_version.to_f < 1
92
+
89
93
  # indent component cfndsl
90
94
  component_cfndsl.gsub!("\n", "\n\t")
91
95
  component_cfndsl.gsub!("\r\n", "\r\n\t")
@@ -95,7 +99,9 @@ module Cfhighlander
95
99
  'dsl' => dsl,
96
100
  'component_cfndsl' => component_cfndsl,
97
101
  'component_requires' => (@@global_extensions_paths + @component.cfndsl_ext_files),
98
- 'distribution_format' => out_format
102
+ 'distribution_format' => out_format,
103
+ 'legacy_cfndsl' => legacy_cfndsl,
104
+ 'cfndsl_version' => cfndsl_version
99
105
  }).instance_eval { binding })
100
106
 
101
107
  # write to output file
@@ -241,9 +241,6 @@ module Cfhighlander
241
241
  end
242
242
  def eval_cfndsl
243
243
  compiler = Cfhighlander::Compiler::ComponentCompiler.new self
244
- # there is no need for processing lambda source code during cloudformation evaluation,
245
- # this version never gets published
246
- compiler.process_lambdas = false
247
244
  @cfn_model = compiler.evaluateCloudFormation().as_json
248
245
  @cfn_model_raw = JSON.parse(@cfn_model.to_json)
249
246
  @outputs = (
@@ -28,7 +28,13 @@ module CfHighlander
28
28
  def get_cases
29
29
  @test_files.each do |file|
30
30
  test_case = load_test_case(file)
31
- @cases << { metadata: test_case['test_metadata'], file: file, config: load_default_config.deep_merge(test_case) }
31
+ test_parameters = test_case['test_parameters'] || {}
32
+ @cases << {
33
+ metadata: test_case['test_metadata'],
34
+ test_parameters: test_parameters,
35
+ file: file,
36
+ config: load_default_config.deep_merge(test_case)
37
+ }
32
38
  end
33
39
  end
34
40
 
@@ -1,3 +1,3 @@
1
1
  module Cfhighlander
2
- VERSION="0.10.7".freeze
2
+ VERSION="0.10.8".freeze
3
3
  end
@@ -2,12 +2,17 @@
2
2
  load('<%= @require %>')
3
3
  <% end %>
4
4
  CloudFormation do
5
-
5
+ # cfhl meta: cfndsl_version=<%=cfndsl_version %>
6
+ <% unless legacy_cfndsl -%>
7
+ <% dsl.config.each_key do |key|-%>
8
+ <%=key-%> = external_parameters.fetch(:<%=key-%>, nil)
9
+ <% end -%>
10
+ <% end -%>
6
11
  <% for @mapping in dsl.mappings %>
7
12
  Mapping('<%= @mapping %>', mappings['<%= @mapping %>'])
8
- <% end %>
13
+ <% end -%>
9
14
 
10
- # render subcomponents
15
+ # render subcomponents
11
16
  <% for @subcomponent in dsl.subcomponents %>
12
17
  CloudFormation_Stack('<%= @subcomponent.cfn_name %>') do
13
18
  TemplateURL '<%= @subcomponent.distribution_url %>'
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.7
4
+ version: 0.10.8.alpha.1582708349
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-12-10 00:00:00.000000000 Z
13
+ date: 2020-02-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: highline
@@ -56,16 +56,22 @@ dependencies:
56
56
  name: cfndsl
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '='
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1'
62
+ - - "<"
60
63
  - !ruby/object:Gem::Version
61
- version: 0.17.2
64
+ version: '2'
62
65
  type: :runtime
63
66
  prerelease: false
64
67
  version_requirements: !ruby/object:Gem::Requirement
65
68
  requirements:
66
- - - '='
69
+ - - "~>"
67
70
  - !ruby/object:Gem::Version
68
- version: 0.17.2
71
+ version: '1'
72
+ - - "<"
73
+ - !ruby/object:Gem::Version
74
+ version: '2'
69
75
  - !ruby/object:Gem::Dependency
70
76
  name: rubyzip
71
77
  requirement: !ruby/object:Gem::Requirement
@@ -271,9 +277,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
271
277
  version: '0'
272
278
  required_rubygems_version: !ruby/object:Gem::Requirement
273
279
  requirements:
274
- - - ">="
280
+ - - ">"
275
281
  - !ruby/object:Gem::Version
276
- version: '0'
282
+ version: 1.3.1
277
283
  requirements: []
278
284
  rubyforge_project:
279
285
  rubygems_version: 2.7.7