Module: Ufo::TaskDefinition::Helpers::StackOutput

Includes:
AwsServices, Concerns::Names, Utils::Logging
Defined in:
lib/ufo/task_definition/helpers/stack_output.rb

Instance Method Summary collapse

Methods included from Utils::Logging

#logger

Methods included from Concerns::Names

#names

Methods included from AwsServices

#acm, #applicationautoscaling, #aws_options, #cfn, #cloudwatchlogs, #ec2, #ecr, #ecs, #elb, #s3, #ssm_client, #waf_client

Methods included from AwsServices::Concerns

#find_stack, #find_stack_resources, #stack_resources, #status, #task_definition_arns

Instance Method Details

#stack_output(name) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/ufo/task_definition/helpers/stack_output.rb', line 7

def stack_output(name)
  stack_name, output_key = name.split(".")
  stack_name = names.expansion(stack_name)
  stack = find_stack(stack_name)
  unless stack
    logger.error "ERROR: Stack not found: #{stack_name}".color(:red)
    call_line = ufo_call_line
    DslEvaluator.print_code(call_line)
    return
  end

  o = stack.outputs.detect { |h| h.output_key == output_key }
  if o
    o.output_value
  else
    logger.warn "WARN: NOT FOUND: output #{output_key} for stack #{stack_name}".color(:yellow)
    nil
  end
end