cfn-model 0.1.34 → 0.1.35
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cfn-model/validator/reference_validator.rb +16 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a7c23dabd4b1d3f0f73056e8ae9fcbe2e973937832985cf60373dd0bde5587c
|
4
|
+
data.tar.gz: 580030b0d1dde7a33caed7d31a9a300e37112bcb679b8460a1959433b2df194e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf866a4c4bf188ad8dcc96564a577df0f072c8333c63467091f60b2092c156dcbbffb3ecb2b1783862c9256ea6c31580071af19a752a9a8cd28d53675b939c47
|
7
|
+
data.tar.gz: 14279bb0655dc6510d06660311b2c2c88bf7ab4cf335d52d68e29088b9fc3e9b4e6002a441abc985bad0333e1b3d811717f86a42ab0444a9a5cf13a793427b9b
|
@@ -9,12 +9,26 @@ class ReferenceValidator
|
|
9
9
|
end
|
10
10
|
|
11
11
|
resource_keys = cloudformation_hash['Resources'].keys
|
12
|
-
|
13
|
-
|
12
|
+
|
13
|
+
legal_identifiers = Set.new(parameter_keys + resource_keys)
|
14
|
+
missing_refs = all_references(cloudformation_hash) - legal_identifiers
|
15
|
+
post_process_special_refs(missing_refs, legal_identifiers)
|
14
16
|
end
|
15
17
|
|
16
18
|
private
|
17
19
|
|
20
|
+
SPECIAL_REF_REGEXP = /(.+)\..+/
|
21
|
+
|
22
|
+
def post_process_special_refs(missing_refs, legal_identifiers)
|
23
|
+
missing_refs.delete_if do |missing_ref|
|
24
|
+
match_data = missing_ref.match SPECIAL_REF_REGEXP
|
25
|
+
if match_data
|
26
|
+
resource_id = match_data[1]
|
27
|
+
legal_identifiers.member?(resource_id)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
18
32
|
def all_references(cloudformation_hash)
|
19
33
|
result = Set.new
|
20
34
|
cloudformation_hash['Resources'].values.each do |resource_hash|
|