class CfnFlow::CachedStack

Attributes

stack_name[R]

Public Class Methods

get_output(stack:, output:) click to toggle source
# File lib/cfn_flow/cached_stack.rb, line 10
def self.get_output(stack:, output:)
  new(stack).output(output)
end
new(stack_name) click to toggle source
# File lib/cfn_flow/cached_stack.rb, line 16
def initialize(stack_name)
  @stack_name = stack_name
end
stack_cache() click to toggle source
# File lib/cfn_flow/cached_stack.rb, line 6
def self.stack_cache
  @stack_cache ||= {}
end

Public Instance Methods

output(name) click to toggle source
# File lib/cfn_flow/cached_stack.rb, line 20
def output(name)
  output = stack_cache.outputs.detect{|out| out.output_key == name }
  unless output
    raise MissingOutput.new("Can't find outpout #{name} for stack #{stack_name}")
  end
  output.output_value
end
stack_cache() click to toggle source
# File lib/cfn_flow/cached_stack.rb, line 28
def stack_cache
  self.class.stack_cache[stack_name] ||= CfnFlow.cfn_resource.stack(stack_name).load
end