cfndsl 1.2.0 → 1.3.0

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: 903e5bbbe4c6bf5e02d3b3a9d6ca8582c0e2836d136347bbe7afd6baf7b2b4d5
4
- data.tar.gz: cd8e5b739f8c2ef469cfa67a17ec90ab736aab0381e69f65b2fd9d7ad1a1e460
3
+ metadata.gz: 4888acd0e17faf09fae382e22f218de5c1fcf3c734d2d6354df78f2980fab112
4
+ data.tar.gz: 90983fc52aba48a1f8ed2b171b15bdc6c87c4e8797938b821bb2f9063bbaa897
5
5
  SHA512:
6
- metadata.gz: 023716cdcc14ff56fac40cfd7851ffb706969886147b42fe9ba3d1b2dee0749c1e819bb8507a4e3671549d15edb426c8022e80e00c90933cacc8ffbfc2ae8967
7
- data.tar.gz: 12f33663d5de5405f109e7ad95d0b0235b35e19513af12081fb175887a5f86b0ae6652d3c3cd44415dce67a30dcebd309b41e82d091119eea1939fdaf5e496f0
6
+ metadata.gz: 55bef3d697fabf51322e0e460d5a1c408ad3eed169eda5bf9ef41d722391327dff41a593f92eb2d89b258cf31a31919e3e055d4a6538ba46c1fbd6251664fc61
7
+ data.tar.gz: 821e4142a8e694f14c69ef73efecb65d757096f2b8255fa4cf7c172dca1299e5184e00c06119e6ad94aa6d4d75aac1b274237122532d854b34c6c197d6055efa
@@ -5,7 +5,7 @@ Metrics/CyclomaticComplexity:
5
5
  Max: 10
6
6
 
7
7
  Metrics/AbcSize:
8
- Max: 25
8
+ Max: 30
9
9
 
10
10
  Metrics/BlockLength:
11
11
  Enabled: false
@@ -13,6 +13,12 @@ Metrics/BlockLength:
13
13
  Metrics/MethodLength:
14
14
  Max: 25
15
15
 
16
+ Metrics/PerceivedComplexity:
17
+ Max: 15
18
+
19
+ Metrics/ClassLength:
20
+ Max: 105
21
+
16
22
  # Due to our @Properties style instance names
17
23
  Naming/VariableName:
18
24
  Enabled: false
@@ -25,6 +31,9 @@ Naming/MethodName:
25
31
  Lint/Void:
26
32
  Enabled: false
27
33
 
34
+ Lint/MissingSuper:
35
+ Enabled: false
36
+
28
37
  Style/SafeNavigation:
29
38
  Enabled: false
30
39
 
@@ -33,7 +42,8 @@ Lint/MixedRegexpCaptureTypes:
33
42
  Enabled: false
34
43
 
35
44
  AllCops:
36
- NewCops: enable
37
- TargetRubyVersion: 2.4
45
+ NewCops: disable
46
+ SuggestExtensions: false
47
+ TargetRubyVersion: 2.7
38
48
  Exclude:
39
49
  - 'tmp/**/*'
@@ -1,6 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.6
3
+ - 2.7
4
4
  sudo: false
5
5
  before_install:
6
6
  - gem update --system
@@ -1,8 +1,22 @@
1
1
  # Changelog
2
2
 
3
- ## [1.2.0](https://github.com/cfndsl/cfndsl/tree/1.2.0) (2020-07-30)
3
+ ## [1.3.0](https://github.com/cfndsl/cfndsl/tree/1.3.0) (2021-01-04)
4
4
 
5
- [Full Changelog](https://github.com/cfndsl/cfndsl/compare/v1.1.1...1.2.0)
5
+ [Full Changelog](https://github.com/cfndsl/cfndsl/compare/v1.2.0...1.3.0)
6
+
7
+ **Closed issues:**
8
+
9
+ - Freeze specifications version [\#466](https://github.com/cfndsl/cfndsl/issues/466)
10
+ - Outdated assertion in Readme [\#459](https://github.com/cfndsl/cfndsl/issues/459)
11
+ - Composing and merging CfnDsl templates [\#375](https://github.com/cfndsl/cfndsl/issues/375)
12
+
13
+ **Merged pull requests:**
14
+
15
+ - enable resource version 22.0.0, some type processing fixes [\#467](https://github.com/cfndsl/cfndsl/pull/467) ([toshke](https://github.com/toshke))
16
+
17
+ ## [v1.2.0](https://github.com/cfndsl/cfndsl/tree/v1.2.0) (2020-07-29)
18
+
19
+ [Full Changelog](https://github.com/cfndsl/cfndsl/compare/v1.1.1...v1.2.0)
6
20
 
7
21
  **Implemented enhancements:**
8
22
 
@@ -27,6 +41,7 @@
27
41
  - test workaround for \#460 [\#463](https://github.com/cfndsl/cfndsl/pull/463) ([lwoggardner](https://github.com/lwoggardner))
28
42
  - Bring up to date [\#462](https://github.com/cfndsl/cfndsl/pull/462) ([lwoggardner](https://github.com/lwoggardner))
29
43
  - Update cfndsl raison d'être [\#461](https://github.com/cfndsl/cfndsl/pull/461) ([lwoggardner](https://github.com/lwoggardner))
44
+ - Fix \#455 [\#456](https://github.com/cfndsl/cfndsl/pull/456) ([lwoggardner](https://github.com/lwoggardner))
30
45
 
31
46
  ## [v1.1.1](https://github.com/cfndsl/cfndsl/tree/v1.1.1) (2020-06-02)
32
47
 
@@ -45,10 +60,6 @@
45
60
 
46
61
  - Shorthand method of accessing resource attributes via FnSub fails reference checks [\#455](https://github.com/cfndsl/cfndsl/issues/455)
47
62
 
48
- **Merged pull requests:**
49
-
50
- - Fix \#455 [\#456](https://github.com/cfndsl/cfndsl/pull/456) ([lwoggardner](https://github.com/lwoggardner))
51
-
52
63
  ## [v1.0.6](https://github.com/cfndsl/cfndsl/tree/v1.0.6) (2020-04-23)
53
64
 
54
65
  [Full Changelog](https://github.com/cfndsl/cfndsl/compare/v1.0.5...v1.0.6)
@@ -178,10 +189,8 @@
178
189
  **Merged pull requests:**
179
190
 
180
191
  - 1.0.0 pre rake and spec [\#427](https://github.com/cfndsl/cfndsl/pull/427) ([lwoggardner](https://github.com/lwoggardner))
181
- - 1.0.0.pre merge fix403 [\#426](https://github.com/cfndsl/cfndsl/pull/426) ([lwoggardner](https://github.com/lwoggardner))
182
192
  - 1.0.0.pre merge with master [\#425](https://github.com/cfndsl/cfndsl/pull/425) ([lwoggardner](https://github.com/lwoggardner))
183
193
  - implement json patch for patches and pull in patches from CDK [\#386](https://github.com/cfndsl/cfndsl/pull/386) ([gergnz](https://github.com/gergnz))
184
- - 0.x changes to 1.0.0.pre [\#361](https://github.com/cfndsl/cfndsl/pull/361) ([gergnz](https://github.com/gergnz))
185
194
  - merge ruby version fix into 1.0.0.pre branch [\#333](https://github.com/cfndsl/cfndsl/pull/333) ([gergnz](https://github.com/gergnz))
186
195
  - remove 'disable\_binding', merge 0.x changes [\#329](https://github.com/cfndsl/cfndsl/pull/329) ([gergnz](https://github.com/gergnz))
187
196
  - Modernize cfndsl executable [\#319](https://github.com/cfndsl/cfndsl/pull/319) ([kornypoet](https://github.com/kornypoet))
@@ -206,6 +215,7 @@
206
215
 
207
216
  **Merged pull requests:**
208
217
 
218
+ - 1.0.0.pre merge fix403 [\#426](https://github.com/cfndsl/cfndsl/pull/426) ([lwoggardner](https://github.com/lwoggardner))
209
219
  - Fix for \#418. This time with less pre 1.0.... [\#420](https://github.com/cfndsl/cfndsl/pull/420) ([cmaxwellau](https://github.com/cmaxwellau))
210
220
 
211
221
  ## [v0.17.2](https://github.com/cfndsl/cfndsl/tree/v0.17.2) (2019-09-05)
@@ -384,6 +394,7 @@
384
394
 
385
395
  - add Fn::Cidr [\#364](https://github.com/cfndsl/cfndsl/pull/364) ([gergnz](https://github.com/gergnz))
386
396
  - fixes for rubocop [\#363](https://github.com/cfndsl/cfndsl/pull/363) ([gergnz](https://github.com/gergnz))
397
+ - 0.x changes to 1.0.0.pre [\#361](https://github.com/cfndsl/cfndsl/pull/361) ([gergnz](https://github.com/gergnz))
387
398
 
388
399
  ## [v0.16.2](https://github.com/cfndsl/cfndsl/tree/v0.16.2) (2017-12-07)
389
400
 
@@ -437,10 +448,6 @@
437
448
  - Support for Lambda backed custom resources with shorthand [\#315](https://github.com/cfndsl/cfndsl/issues/315)
438
449
  - Merging cfnlego, cfn2dsl into cfndsl [\#272](https://github.com/cfndsl/cfndsl/issues/272)
439
450
 
440
- **Merged pull requests:**
441
-
442
- - Fix parameter parsing when its value contains equal symbol [\#340](https://github.com/cfndsl/cfndsl/pull/340) ([ans0600](https://github.com/ans0600))
443
-
444
451
  ## [v0.15.2](https://github.com/cfndsl/cfndsl/tree/v0.15.2) (2017-06-20)
445
452
 
446
453
  [Full Changelog](https://github.com/cfndsl/cfndsl/compare/v0.15.1...v0.15.2)
@@ -472,6 +479,7 @@
472
479
 
473
480
  **Merged pull requests:**
474
481
 
482
+ - Fix parameter parsing when its value contains equal symbol [\#340](https://github.com/cfndsl/cfndsl/pull/340) ([ans0600](https://github.com/ans0600))
475
483
  - Clean up of README [\#330](https://github.com/cfndsl/cfndsl/pull/330) ([elmobp](https://github.com/elmobp))
476
484
  - enable deep merge as the default for yaml [\#328](https://github.com/cfndsl/cfndsl/pull/328) ([gergnz](https://github.com/gergnz))
477
485
 
@@ -515,6 +523,7 @@
515
523
  **Merged pull requests:**
516
524
 
517
525
  - Remove release\_url config from github changelog generator [\#316](https://github.com/cfndsl/cfndsl/pull/316) ([mikechau](https://github.com/mikechau))
526
+ - IAM Managed Policy: Add support for ManagedPolicyName property [\#310](https://github.com/cfndsl/cfndsl/pull/310) ([mikechau](https://github.com/mikechau))
518
527
  - WIP: Aws schema [\#278](https://github.com/cfndsl/cfndsl/pull/278) ([kornypoet](https://github.com/kornypoet))
519
528
 
520
529
  ## [v0.12.11](https://github.com/cfndsl/cfndsl/tree/v0.12.11) (2017-05-10)
@@ -548,7 +557,6 @@
548
557
  **Merged pull requests:**
549
558
 
550
559
  - CloudFormation::Stack: Add Tags property [\#311](https://github.com/cfndsl/cfndsl/pull/311) ([mikechau](https://github.com/mikechau))
551
- - IAM Managed Policy: Add support for ManagedPolicyName property [\#310](https://github.com/cfndsl/cfndsl/pull/310) ([mikechau](https://github.com/mikechau))
552
560
 
553
561
  ## [v0.12.7](https://github.com/cfndsl/cfndsl/tree/v0.12.7) (2017-04-23)
554
562
 
@@ -978,6 +986,10 @@
978
986
 
979
987
  [Full Changelog](https://github.com/cfndsl/cfndsl/compare/v0.8.0...v0.8.1)
980
988
 
989
+ **Implemented enhancements:**
990
+
991
+ - Use as\_json instead of to\_json [\#157](https://github.com/cfndsl/cfndsl/pull/157) ([johnf](https://github.com/johnf))
992
+
981
993
  **Merged pull requests:**
982
994
 
983
995
  - Add in Route53 Health Check Tags as a type [\#185](https://github.com/cfndsl/cfndsl/pull/185) ([gergnz](https://github.com/gergnz))
data/README.md CHANGED
@@ -22,7 +22,7 @@ The cnfdsl gem provides a DSL that allows you to write templates using friendly
22
22
 
23
23
  ## Getting Started
24
24
 
25
- ruby version > 2.4 is required to run cfndsl, you should look at using rbenv example for installing with rbenv
25
+ ruby version > 2.7 is required to run cfndsl, you should look at using rbenv example for installing with rbenv
26
26
 
27
27
  rbenv exec gem install cfndsl
28
28
 
@@ -17,10 +17,10 @@ Gem::Specification.new do |s|
17
17
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
18
18
  s.require_paths = ['lib']
19
19
  s.bindir = 'exe'
20
- s.required_ruby_version = '~> 2.4'
20
+ s.required_ruby_version = '~> 2.7'
21
21
 
22
22
  s.executables << 'cfndsl'
23
23
 
24
- s.add_development_dependency 'bundler', '~> 2.1'
24
+ s.add_development_dependency 'bundler', '~> 2.2'
25
25
  s.add_runtime_dependency 'hana', '~> 1.3'
26
26
  end
@@ -0,0 +1,41 @@
1
+ {
2
+ "broken": "22.0.0",
3
+ "ResourceTypes": {
4
+ "AWS::SageMaker::Device": {
5
+ "patch": {
6
+ "operations": [
7
+ {
8
+ "op": "replace",
9
+ "path": "/Properties/Tags",
10
+ "value": {
11
+ "Type": "List",
12
+ "ItemType": "Tag",
13
+ "Required": false,
14
+ "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sagemaker-device.html#cfn-sagemaker-device-tags",
15
+ "UpdateType": "Mutable"
16
+ }
17
+ }
18
+ ],
19
+ "description": "Fix SageMaker Device to be List of Tag"
20
+ }
21
+ },
22
+ "AWS::SageMaker::DeviceFleet": {
23
+ "patch": {
24
+ "operations": [
25
+ {
26
+ "op": "replace",
27
+ "path": "/Properties/Tags",
28
+ "value": {
29
+ "Type": "List",
30
+ "ItemType": "Tag",
31
+ "Required": false,
32
+ "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sagemaker-device.html#cfn-sagemaker-device-tags",
33
+ "UpdateType": "Mutable"
34
+ }
35
+ }
36
+ ],
37
+ "description": "Fix SageMaker Device to be List of Tag"
38
+ }
39
+ }
40
+ }
41
+ }
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative 'version'
4
+ require 'fileutils'
4
5
 
5
6
  # Global variables to adjust CfnDsl behavior
6
7
  module CfnDsl
@@ -136,12 +136,13 @@ module CfnDsl
136
136
  check_names
137
137
  hash = {}
138
138
  instance_variables.each do |var|
139
- name = var[1..-1]
139
+ name = var[1..]
140
140
 
141
- if name =~ /^__/
141
+ case name
142
+ when /^__/
142
143
  # if a variable starts with double underscore, strip one off
143
- name = name[1..-1]
144
- elsif name =~ /^_/
144
+ name = name[1..]
145
+ when /^_/
145
146
  # Hide variables that start with single underscore
146
147
  name = nil
147
148
  end
@@ -83,7 +83,6 @@ module CfnDsl
83
83
  resource_name
84
84
  end
85
85
 
86
- # rubocop:disable Metrics/PerceivedComplexity
87
86
  def create_array_property_def(resource, pname, pclass, info)
88
87
  singular_name = CfnDsl::Plurals.singularize pname
89
88
  plural_name = singular_name == pname ? CfnDsl::Plurals.pluralize(pname) : pname
@@ -111,7 +110,6 @@ module CfnDsl
111
110
  # Singular form understands concatenation and Fn::If property
112
111
  create_singular_property_def(resource, pname, pclass, singular_name) if singular_name
113
112
  end
114
- # rubocop:enable Metrics/PerceivedComplexity
115
113
 
116
114
  def create_resource_accessor(accessor, resource, type)
117
115
  class_eval do
@@ -245,7 +243,7 @@ module CfnDsl
245
243
  end
246
244
  end
247
245
 
248
- # rubocop:disable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
246
+ # rubocop:disable Metrics/CyclomaticComplexity
249
247
  def _check_refs(container_name, method, source_containers)
250
248
  container = instance_variable_get("@#{container_name}s")
251
249
  return [] unless container
@@ -279,7 +277,7 @@ module CfnDsl
279
277
 
280
278
  invalids
281
279
  end
282
- # rubocop:enable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
280
+ # rubocop:enable Metrics/CyclomaticComplexity
283
281
 
284
282
  def validate
285
283
  errors = check_refs || []
@@ -20,7 +20,7 @@ module CfnDsl
20
20
  @singles = @plurals.invert
21
21
 
22
22
  def pluralize(name)
23
- @plurals.fetch(name.to_s) { |key| key + 's' }
23
+ @plurals.fetch(name.to_s) { |key| "#{key}s" }
24
24
  end
25
25
 
26
26
  def singularize(name)
@@ -29,7 +29,7 @@ module CfnDsl
29
29
  when /List$/
30
30
  key[0..-5]
31
31
  when /ies$/
32
- key[0..-4] + 'y'
32
+ "#{key[0..-4]}y"
33
33
  when /s$/
34
34
  key[0..-2]
35
35
  else
@@ -79,7 +79,7 @@ module CfnDsl
79
79
  # then any existing file is considered sufficient, and 'latest' is the version used for downloading
80
80
  #
81
81
  # @todo Add capability to provide a user spec/patches dir
82
- def specification(name: nil, file:, version: nil)
82
+ def specification(file:, name: nil, version: nil)
83
83
  if name
84
84
  desc 'Update Resource Specification' unless ::Rake.application.last_description
85
85
  task name, [:cfn_spec_version] => file
@@ -218,7 +218,7 @@ module CfnDsl
218
218
  end
219
219
 
220
220
  def verbose
221
- (Rake.verbose? || cfndsl_opts&.fetch(:verbose, false)) && STDERR
221
+ (Rake.verbose? || cfndsl_opts&.fetch(:verbose, false)) && $stderr
222
222
  end
223
223
 
224
224
  def generate(opts)
@@ -238,8 +238,8 @@ module CfnDsl
238
238
  verbose&.puts("Writing to #{type}")
239
239
  end
240
240
 
241
- def outputter(opts)
242
- opts[:output].nil? ? yield(STDOUT) : file_output(opts[:output]) { |f| yield f }
241
+ def outputter(opts, &block)
242
+ opts[:output].nil? ? yield($stdout) : file_output(opts[:output], &block)
243
243
  end
244
244
 
245
245
  def model(filename)
@@ -253,8 +253,8 @@ module CfnDsl
253
253
  cfndsl_opts.fetch(:extras, [])
254
254
  end
255
255
 
256
- def file_output(path)
257
- File.open(File.expand_path(path), 'w') { |f| yield f }
256
+ def file_output(path, &block)
257
+ File.open(File.expand_path(path), 'w', &block)
258
258
  end
259
259
  end
260
260
  # rubocop:enable Metrics/ClassLength
@@ -10,7 +10,7 @@ module RefCheck
10
10
  end
11
11
 
12
12
  # Build up a set of references.
13
- # rubocop:disable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
13
+ # rubocop:disable Metrics/CyclomaticComplexity
14
14
  def build_references(refs = [], origin = nil, method = :all_refs)
15
15
  if respond_to?(method)
16
16
  send(method).each do |ref|
@@ -30,7 +30,7 @@ module RefCheck
30
30
 
31
31
  refs
32
32
  end
33
- # rubocop:enable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
33
+ # rubocop:enable Metrics/CyclomaticComplexity
34
34
 
35
35
  def ref_children
36
36
  []
@@ -117,14 +117,14 @@ module CfnDsl
117
117
  end
118
118
 
119
119
  filename = File.expand_path(ARGV[0])
120
- verbose = options[:verbose] && STDERR
120
+ verbose = options[:verbose] && $stderr
121
121
 
122
122
  verbose.puts "Using specification file #{CfnDsl.specification_file}" if verbose
123
123
 
124
124
  require_relative 'cloudformation'
125
125
  model = CfnDsl.eval_file_with_extras(filename, options[:extras], verbose)
126
126
 
127
- output = STDOUT
127
+ output = $stdout
128
128
  if options[:output] != '-'
129
129
  verbose.puts("Writing to #{options[:output]}") if verbose
130
130
  output = File.open(File.expand_path(options[:output]), 'w')
@@ -70,20 +70,18 @@ module CfnDsl
70
70
  next unless %w[ResourceTypes PropertyTypes].include?(top_level_type)
71
71
 
72
72
  patches.each_pair do |property_type_name, patch_details|
73
- begin
74
- applies_to = spec[top_level_type]
75
- unless property_type_name == 'patch'
76
- # Patch applies within a specific property type
77
- applies_to = applies_to[property_type_name]
78
- patch_details = patch_details['patch']
79
- end
80
-
81
- Hana::Patch.new(patch_details['operations']).apply(applies_to) if patch_required?(patch_details)
82
- rescue Hana::Patch::MissingTargetException => e
83
- raise "Failed specification patch #{top_level_type} #{property_type_name} from #{from_file}" if fail_patches
84
-
85
- warn "Ignoring failed specification patch #{top_level_type} #{property_type_name} from #{from_file} - #{e.class.name}:#{e.message}"
73
+ applies_to = spec[top_level_type]
74
+ unless property_type_name == 'patch'
75
+ # Patch applies within a specific property type
76
+ applies_to = applies_to[property_type_name]
77
+ patch_details = patch_details['patch']
86
78
  end
79
+
80
+ Hana::Patch.new(patch_details['operations']).apply(applies_to) if patch_required?(patch_details)
81
+ rescue Hana::Patch::MissingTargetException => e
82
+ raise "Failed specification patch #{top_level_type} #{property_type_name} from #{from_file}" if fail_patches
83
+
84
+ warn "Ignoring failed specification patch #{top_level_type} #{property_type_name} from #{from_file} - #{e.class.name}:#{e.message}"
87
85
  end
88
86
  end
89
87
  end
@@ -16,7 +16,7 @@ module CfnDsl
16
16
  { 'Resources' => resources, 'Types' => types, 'Version' => spec.version, 'File' => spec.file }
17
17
  end
18
18
 
19
- # rubocop:disable Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/MethodLength, Metrics/CyclomaticComplexity
19
+ # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity
20
20
  def self.extract_resources(spec)
21
21
  spec.each_with_object({}) do |(resource_name, resource_info), resources|
22
22
  properties = resource_info['Properties'].each_with_object({}) do |(property_name, property_info), extracted|
@@ -43,7 +43,8 @@ module CfnDsl
43
43
  # resource name for uniqueness and connection
44
44
  property_type = resource_name.split('::').join + property_info['Type']
45
45
  else
46
- warn "could not extract resource type from #{resource_name}"
46
+ warn "could not extract resource type for property #{property_name} from #{resource_name}, assuming Json"
47
+ property_type = 'Json'
47
48
  end
48
49
  extracted[property_name] = property_type
49
50
  extracted
@@ -52,7 +53,7 @@ module CfnDsl
52
53
  resources
53
54
  end
54
55
  end
55
- # rubocop:enable Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/MethodLength
56
+ # rubocop:enable Metrics/AbcSize, Metrics/MethodLength
56
57
 
57
58
  # rubocop:disable Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/MethodLength
58
59
  def self.extract_types(spec)
@@ -99,6 +100,8 @@ module CfnDsl
99
100
  nested_prop_type =
100
101
  if nested_prop_info['ItemType'] == 'Tag'
101
102
  ['Tag']
103
+ elsif (nested_prop_info['ItemType'] == 'Json') && (nested_prop_info['Type'] == 'List')
104
+ ['Json']
102
105
  else
103
106
  Array(root_resource_name + nested_prop_info['ItemType'])
104
107
  end
@@ -106,7 +109,8 @@ module CfnDsl
106
109
  elsif nested_prop_info['Type']
107
110
  nested_prop_type = root_resource_name + nested_prop_info['Type']
108
111
  else
109
- warn "could not extract property type from #{property_name}"
112
+ warn "could not extract property type for #{nested_prop_name} from #{property_name}, assuming Json"
113
+ nested_prop_type = 'Json'
110
114
  p nested_prop_info
111
115
  end
112
116
  extracted[nested_prop_name] = nested_prop_type
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CfnDsl
4
- VERSION = '1.2.0'
4
+ VERSION = '1.3.0'
5
5
  end
@@ -120,16 +120,16 @@ module DeepMerge
120
120
  puts "#{di} looping: #{src_key.inspect} => #{src_value.inspect} :: #{dest.inspect}" if merge_debug
121
121
  if dest[src_key]
122
122
  puts "#{di} ==>merging: #{src_key.inspect} => #{src_value.inspect} :: #{dest[src_key].inspect}" if merge_debug
123
- dest[src_key] = deep_merge!(src_value, dest[src_key], options.merge(debug_indent: di + ' '))
123
+ dest[src_key] = deep_merge!(src_value, dest[src_key], options.merge(debug_indent: "#{di} "))
124
124
  else # dest[src_key] doesn't exist so we want to create and overwrite it (but we do this via deep_merge!)
125
125
  puts "#{di} ==>merging over: #{src_key.inspect} => #{src_value.inspect}" if merge_debug
126
- # note: we rescue here b/c some classes respond to "dup" but don't implement it (Numeric, TrueClass, FalseClass, NilClass among maybe others)
126
+ # NOTE: we rescue here b/c some classes respond to "dup" but don't implement it (Numeric, TrueClass, FalseClass, NilClass among maybe others)
127
127
  begin
128
128
  src_dup = src_value.dup # we dup src_value if possible because we're going to merge into it (since dest is empty)
129
129
  rescue TypeError
130
130
  src_dup = src_value
131
131
  end
132
- dest[src_key] = deep_merge!(src_value, src_dup, options.merge(debug_indent: di + ' '))
132
+ dest[src_key] = deep_merge!(src_value, src_dup, options.merge(debug_indent: "#{di} "))
133
133
  end
134
134
  elsif dest.is_a?(Array) && extend_existing_arrays
135
135
  dest.push(source)
@@ -181,12 +181,12 @@ module DeepMerge
181
181
  list = []
182
182
  dest.each_index do |i|
183
183
  list[i] = deep_merge!(source[i] || {}, dest[i],
184
- options.merge(debug_indent: di + ' '))
184
+ options.merge(debug_indent: "#{di} "))
185
185
  end
186
- list += source[dest.count..-1] if source.count > dest.count
186
+ list += source[dest.count..] if source.count > dest.count
187
187
  dest = list
188
188
  elsif keep_array_duplicates
189
- dest = dest.concat(source)
189
+ dest.concat(source)
190
190
  else
191
191
  dest |= source
192
192
  end
@@ -23,8 +23,8 @@ CloudFormation do
23
23
 
24
24
  10.times do |i|
25
25
  subnet = "subnet#{i}"
26
- route_table = subnet + 'RouteTable'
27
- route_table_assoc = route_table + 'Assoc'
26
+ route_table = "#{subnet}RouteTable"
27
+ route_table_assoc = "#{route_table}Assoc"
28
28
 
29
29
  Subnet(subnet) do
30
30
  VpcId Ref(:VPC)
@@ -42,7 +42,7 @@ CloudFormation do
42
42
  RouteTableId Ref(route_table)
43
43
  end
44
44
 
45
- EC2_Route(subnet + 'GatewayRoute') do
45
+ EC2_Route("#{subnet}GatewayRoute") do
46
46
  DependsOn :GatewayToInternet
47
47
  RouteTableId Ref(route_table)
48
48
  DestinationCidrBlock '0.0.0.0/0'
@@ -41,8 +41,8 @@ CloudFormation do
41
41
 
42
42
  10.times do |i|
43
43
  subnet = "subnet#{i}"
44
- route_table = subnet + 'RouteTable'
45
- route_table_assoc = route_table + 'Assoc'
44
+ route_table = "#{subnet}RouteTable"
45
+ route_table_assoc = "#{route_table}Assoc"
46
46
 
47
47
  Subnet(subnet) do
48
48
  VpcId Ref(:VPC)
@@ -60,7 +60,7 @@ CloudFormation do
60
60
  RouteTableId Ref(route_table)
61
61
  end
62
62
 
63
- EC2_Route(subnet + 'GatewayRoute') do
63
+ EC2_Route("#{subnet}GatewayRoute") do
64
64
  DependsOn :GatewayToInternet
65
65
  RouteTableId Ref(route_table)
66
66
  DestinationCidrBlock '0.0.0.0/0'
@@ -36,7 +36,9 @@ describe 'cfndsl', type: :aruba do
36
36
  before(:each) { write_file('template.rb', template_content) }
37
37
 
38
38
  # The known working version is the embedded version
39
+ # rubocop:disable Lint/ConstantDefinitionInBlock
39
40
  WORKING_SPEC_VERSION = JSON.parse(File.read(CfnDsl::LOCAL_SPEC_FILE))['ResourceSpecificationVersion']
41
+ # rubocop:enable Lint/ConstantDefinitionInBlock
40
42
 
41
43
  context "cfndsl -u #{WORKING_SPEC_VERSION}" do
42
44
  it 'updates the specification file' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cfndsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Jack
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: exe
13
13
  cert_chain: []
14
- date: 2020-07-29 00:00:00.000000000 Z
14
+ date: 2021-01-03 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler
@@ -19,14 +19,14 @@ dependencies:
19
19
  requirements:
20
20
  - - "~>"
21
21
  - !ruby/object:Gem::Version
22
- version: '2.1'
22
+ version: '2.2'
23
23
  type: :development
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: '2.1'
29
+ version: '2.2'
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: hana
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -84,6 +84,7 @@ files:
84
84
  - lib/cfndsl/aws/patches/600_RefKinds_patch.json
85
85
  - lib/cfndsl/aws/patches/700_SAM_Serverless_Function_InlineCode_patch.json
86
86
  - lib/cfndsl/aws/patches/800_List_types_patch.json
87
+ - lib/cfndsl/aws/patches/900_SageMakerTags_patch.json
87
88
  - lib/cfndsl/aws/resource_specification.json
88
89
  - lib/cfndsl/aws/types.rb
89
90
  - lib/cfndsl/aws/types.yaml
@@ -185,7 +186,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
185
186
  requirements:
186
187
  - - "~>"
187
188
  - !ruby/object:Gem::Version
188
- version: '2.4'
189
+ version: '2.7'
189
190
  required_rubygems_version: !ruby/object:Gem::Requirement
190
191
  requirements:
191
192
  - - ">="