Sha256: 590a095723ccddd10e1153b462e9fba738bafbea563d69140f774b23ff06e44d

Contents?: true

Size: 873 Bytes

Versions: 15

Compression:

Stored size: 873 Bytes

Contents

require 'aws/cloud_formation'
require 'cloud_formation/bridge/resources/base'

module CloudFormation
  module Bridge
    module Resources

      class CloudFormationOutputs < Base

        NAME = 'Name'

        def create(request)
          require_fields(request, [NAME])

          stack_name = request.resource_properties[NAME]

          stack = stacks[stack_name]

          outputs = stack.outputs.inject({}) do |acc,output|
            acc[output.key] = output.value
            acc
          end

          {
            FIELDS::DATA => outputs,
            FIELDS::PHYSICAL_RESOURCE_ID => stack.stack_id,
          }
        end

        alias_method :update, :create

        def delete(request)
          # no need to do anything here
        end

        def stacks
          @stacks ||= AWS::CloudFormation.new.stacks
        end

      end

    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
cfn-bridge-0.0.16 lib/cloud_formation/bridge/resources/cloud_formation_outputs.rb
cfn-bridge-0.0.15 lib/cloud_formation/bridge/resources/cloud_formation_outputs.rb
cfn-bridge-0.0.14 lib/cloud_formation/bridge/resources/cloud_formation_outputs.rb
cfn-bridge-0.0.13 lib/cloud_formation/bridge/resources/cloud_formation_outputs.rb
cfn-bridge-0.0.11 lib/cloud_formation/bridge/resources/cloud_formation_outputs.rb
cfn-bridge-0.0.10 lib/cloud_formation/bridge/resources/cloud_formation_outputs.rb
cfn-bridge-0.0.9 lib/cloud_formation/bridge/resources/cloud_formation_outputs.rb
cfn-bridge-0.0.8 lib/cloud_formation/bridge/resources/cloud_formation_outputs.rb
cfn-bridge-0.0.7 lib/cloud_formation/bridge/resources/cloud_formation_outputs.rb
cfn-bridge-0.0.6 lib/cloud_formation/bridge/resources/cloud_formation_outputs.rb
cfn-bridge-0.0.5 lib/cloud_formation/bridge/resources/cloud_formation_outputs.rb
cfn-bridge-0.0.4 lib/cloud_formation/bridge/resources/cloud_formation_outputs.rb
cfn-bridge-0.0.3 lib/cloud_formation/bridge/resources/cloud_formation_outputs.rb
cfn-bridge-0.0.2 lib/cloud_formation/bridge/resources/cloud_formation_outputs.rb
cfn-bridge-0.0.1 lib/cloud_formation/bridge/resources/cloud_formation_outputs.rb