Method: CloudFormationTool::CloudFormation::Stack#resources

Defined in:
lib/cloud_formation_tool/cloud_formation/stack.rb

#resourcesObject



150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# File 'lib/cloud_formation_tool/cloud_formation/stack.rb', line 150

def resources
  begin
    awscf.list_stack_resources(stack_name: @name).each do |resp|
      resp.stack_resource_summaries.each do |res|
        yield res
        if res.resource_type == 'AWS::CloudFormation::Stack'
          Stack.new(res.physical_resource_id).resources do |nested_res|
            yield nested_res
          end
        end
      end
    end
  rescue Aws::CloudFormation::Errors::ValidationError => e
    raise CloudFormationTool::Errors::AppError, "Failed to get resources: #{e.message}"
  end
end