cfndsl 1.0.6 → 1.1.0

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: 80c8059b1c93fbda0e1d99c571151e7f3d304f58e5aab6a77fc742ded0e60e8d
4
- data.tar.gz: 70bc2d78fcf6187bb06f6c3d345f2947b3d95904d18efb232287757c0561d6d3
3
+ metadata.gz: 9cf9bc6b5e89d82bad3ceb1d70ca8d21e45b56a0ddf10a86c193a276ed002ce7
4
+ data.tar.gz: 2c18e5728f5344dfea8a25250710859b232f1db9bbff9eab1e2265bbc1a38be0
5
5
  SHA512:
6
- metadata.gz: ae4df9627c992947913d19e2bf997ce38a2e256e460a34750bc9f210c2fa84cf696785aed3d8017270c865be32c7ff2b780a29d5720788d2a687ed9de0483709
7
- data.tar.gz: fd5c4d3b66df51391a2a1c3cfe28102383efbe1e681b21191cdc301ca283782ce0082b6be4221effbbd86b7680d433e4b2a5540668b6bbcd80891fb47da5bcb5
6
+ metadata.gz: 867b4f09e4f6003b74d7fc6f7893d96022219c1e28e8d4cc4238820735373fed90380c387dc1fced44f5bc0698c9e9ad604fde82551f7d2f105fcdb017c0faec
7
+ data.tar.gz: 0baf10e9ca24ea7bee83915ccf6a7b1ef2036ad80c3887da67b56bed34fd6aabd9d72d37c55b5081ce91175c61cc554feee9c0b979dd48d7aab4aa06611a8483
@@ -1,7 +1,18 @@
1
1
  # Change Log
2
2
 
3
- ## [1.0.6](https://github.com/cfndsl/cfndsl/tree/1.0.6) (2020-04-24)
4
- [Full Changelog](https://github.com/cfndsl/cfndsl/compare/v1.0.5...1.0.6)
3
+ ## [1.1.0](https://github.com/cfndsl/cfndsl/tree/1.1.0) (2020-06-01)
4
+ [Full Changelog](https://github.com/cfndsl/cfndsl/compare/v1.0.6...1.1.0)
5
+
6
+ **Closed issues:**
7
+
8
+ - Shorthand method of accessing resource attributes via FnSub fails reference checks [\#455](https://github.com/cfndsl/cfndsl/issues/455)
9
+
10
+ **Merged pull requests:**
11
+
12
+ - Fix \#455 [\#456](https://github.com/cfndsl/cfndsl/pull/456) ([lwoggardner](https://github.com/lwoggardner))
13
+
14
+ ## [v1.0.6](https://github.com/cfndsl/cfndsl/tree/v1.0.6) (2020-04-23)
15
+ [Full Changelog](https://github.com/cfndsl/cfndsl/compare/v1.0.5...v1.0.6)
5
16
 
6
17
  **Fixed bugs:**
7
18
 
@@ -138,10 +149,6 @@
138
149
  ## [v0.17.3](https://github.com/cfndsl/cfndsl/tree/v0.17.3) (2019-09-13)
139
150
  [Full Changelog](https://github.com/cfndsl/cfndsl/compare/v0.17.2...v0.17.3)
140
151
 
141
- **Merged pull requests:**
142
-
143
- - Fix for \#418. This time with less pre 1.0.... [\#420](https://github.com/cfndsl/cfndsl/pull/420) ([cmaxwellau](https://github.com/cmaxwellau))
144
-
145
152
  ## [v0.17.2](https://github.com/cfndsl/cfndsl/tree/v0.17.2) (2019-09-05)
146
153
  [Full Changelog](https://github.com/cfndsl/cfndsl/compare/v0.17.1...v0.17.2)
147
154
 
@@ -240,6 +247,7 @@
240
247
 
241
248
  **Merged pull requests:**
242
249
 
250
+ - Fix for \#418. This time with less pre 1.0.... [\#420](https://github.com/cfndsl/cfndsl/pull/420) ([cmaxwellau](https://github.com/cmaxwellau))
243
251
  - implement json patch for patches and pull in patches from CDK [\#386](https://github.com/cfndsl/cfndsl/pull/386) ([gergnz](https://github.com/gergnz))
244
252
 
245
253
  ## [v0.16.9](https://github.com/cfndsl/cfndsl/tree/v0.16.9) (2018-12-07)
@@ -87,7 +87,7 @@ module CfnDsl
87
87
  def FnSub(string, substitutions = nil)
88
88
  raise ArgumentError, 'The first argument passed to Fn::Sub must be a string' unless string.is_a? String
89
89
 
90
- refs = string.scan(FN_SUB_SCANNER).map(&:first)
90
+ refs = string.scan(FN_SUB_SCANNER).map(&:first).map { |r| r.split('.', 2).first }
91
91
 
92
92
  if substitutions
93
93
  raise ArgumentError, 'The second argument passed to Fn::Sub must be a Hash' unless substitutions.is_a? Hash
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CfnDsl
4
- VERSION = '1.0.6'
4
+ VERSION = '1.1.0'
5
5
  end
@@ -40,6 +40,26 @@ describe CfnDsl::CloudFormationTemplate do
40
40
  expect(subject.validate).to equal(subject)
41
41
  end
42
42
 
43
+ it 'returns self if there are valid Fn::Sub references to other resources' do
44
+ tr = subject.Resource(:TestResource)
45
+ tr.Type('Custom-TestType')
46
+ tr.Property(:AProperty, tr.FnSub('prefix ${TestResource2}suffix'))
47
+
48
+ t2 = subject.Resource('TestResource2')
49
+ t2.Type('Custom-TestType')
50
+ expect(subject.validate).to equal(subject)
51
+ end
52
+
53
+ it 'returns self if there are valid Fn::Sub references to other resource attributes' do
54
+ tr = subject.Resource(:TestResource)
55
+ tr.Type('Custom-TestType')
56
+ tr.Property(:AProperty, tr.FnSub('prefix ${TestResource2.AnAttribute}suffix'))
57
+
58
+ t2 = subject.Resource('TestResource2')
59
+ t2.Type('Custom-TestType')
60
+ expect(subject.validate).to equal(subject)
61
+ end
62
+
43
63
  it 'returns self if there are valid DependsOn to other resources' do
44
64
  tr = subject.Resource(:TestResource)
45
65
  tr.Type('Custom-TestType')
@@ -119,6 +139,13 @@ describe CfnDsl::CloudFormationTemplate do
119
139
  expect { subject.validate }.to raise_error(CfnDsl::Error, /TestResource.*itself/i)
120
140
  end
121
141
 
142
+ it 'raises CfnDsl::Error if a resourcs references itself in Fn::Sub attribute expression' do
143
+ tr = subject.Resource(:TestResource)
144
+ tr.Type('Custom-TestType')
145
+ tr.Property(:AProperty, tr.FnSub('${TestResource.attr}'))
146
+ expect { subject.validate }.to raise_error(CfnDsl::Error, /TestResource.*itself/i)
147
+ end
148
+
122
149
  it 'raises CfnDsl::Error if there are cyclic DependsOn references' do
123
150
  tr = subject.Resource(:ResourceOne)
124
151
  tr.Type('Custom-TestType')
@@ -211,6 +238,12 @@ describe CfnDsl::CloudFormationTemplate do
211
238
  expect(subject.validate).to equal(subject)
212
239
  end
213
240
 
241
+ it 'returns self if there are valid Fn::Sub references to resource attributes' do
242
+ subject.Resource(:TestResource)
243
+ subject.Output('TestResourceOutput').Value(subject.FnSub('prefix ${TestResource.attr}suffix'))
244
+ expect(subject.validate).to equal(subject)
245
+ end
246
+
214
247
  it 'raises CfnDsl::Error if references a non existent condition' do
215
248
  subject.Output(:TestOutput).Condition('NoCondition')
216
249
  expect { subject.validate }.to raise_error(CfnDsl::Error, /TestOutput.*NoCondition/)
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.0.6
4
+ version: 1.1.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-04-23 00:00:00.000000000 Z
14
+ date: 2020-05-31 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler