7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/cfn_manage/cf_common.rb', line 7
def self.visit_stack(cf_client, stack_name, handler, visit_substacks)
stack_resources = cf_client.describe_stack_resources(stack_name: stack_name)
stack = cf_client.describe_stacks(stack_name: stack_name)
handler.call(stack['stacks'][0].stack_name)
return unless visit_substacks
stack_resources['stack_resources'].each do |resource|
if resource['resource_type'] == 'AWS::CloudFormation::Stack'
substack_name = resource['physical_resource_id'].split('/')[1]
self.visit_stack(cf_client, substack_name, handler, visit_substacks)
end
end
end
|