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

Extended by:
Memoist
Includes:
AwsServices
Defined in:
lib/lono/template/strategy/dsl/builder/helpers/stack_helper.rb

Instance Method Summary collapse

Methods included from AwsServices

#cfn, #ec2, #iam, #s3, #s3_presigner, #s3_resource, #sts

Methods included from AwsServices::Helper

#rollback_complete?, #testing_update?

Methods included from AwsServices::StackSet

#find_stack_set, #stack_set_exists?

Methods included from AwsServices::Stack

#find_stack, #stack_exists?

Instance Method Details

#lookup_output(name) ⇒ Object



33
34
35
36
37
38
# 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) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 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) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
# 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