5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/cloudformation_tag_parser.rb', line 5
def tags(cloudformation_json:,
logical_resource_id:)
cloudformation = JSON.load(cloudformation_json)
if cloudformation['Resources'].nil?
raise 'malformed json, must have Resources key at least'
end
resource = cloudformation['Resources'][logical_resource_id]
if resource.nil?
raise "logical resource id #{logical_resource_id} is not found"
end
tags = resource['Properties']['Tags']
tags.nil? ? [] : tags
end
|