module Lono::Template::Strategy::Dsl::Builder::Helpers::StackHelper

Public Instance Methods

lookup_output(name) click to toggle source
# File lib/lono/template/strategy/dsl/builder/helpers/stack_helper.rb, line 33
def lookup_output(name)
  result = stack_output(name)
  return unless ENV['LONO_DEPRECATION_SOFT']
  puts "DEPRECATION WARNING: lookup_output is deprecated. Please use stack_output instead".color(:yellow)
  result
end
stack_output(name) click to toggle source
# File lib/lono/template/strategy/dsl/builder/helpers/stack_helper.rb, line 6
def stack_output(name)
  stack_name, key = name.split(".")
  resp = describe_stacks(stack_name: stack_name)
  stack = resp.stacks.first
  if stack
    o = stack.outputs.detect { |h| h.output_key == key }
  end

  if o
    o.output_value
  else
    "NOT FOUND: output #{key} for stack #{stack_name}"
  end
end
stack_resource(name) click to toggle source
# File lib/lono/template/strategy/dsl/builder/helpers/stack_helper.rb, line 21
def stack_resource(name)
  stack_name, logical_id = name.split(".")
  resp = describe_stack_resources(stack_name: stack_name)
  resources = resp.stack_resources
  resource = resources.find { |r| r.logical_resource_id == logical_id }
  if resource
    resource.physical_resource_id
  else
    "NOT FOUND: logical_id #{logical_id} for stack #{stack_name}"
  end
end

Private Instance Methods

describe_stack_resources(options={}) click to toggle source
# File lib/lono/template/strategy/dsl/builder/helpers/stack_helper.rb, line 46
def describe_stack_resources(options={})
  cfn.describe_stack_resources(options)
end
describe_stacks(options={}) click to toggle source
# File lib/lono/template/strategy/dsl/builder/helpers/stack_helper.rb, line 41
def describe_stacks(options={})
  cfn.describe_stacks(options)
end