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

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

Instance Method Summary collapse

Methods included from Concerns::Names

#names

Methods included from AwsServices

#acm, #applicationautoscaling, #aws_options, #cloudformation, #cloudwatchlogs, #ec2, #ecr, #ecs, #elb, #find_stack, #ssm_client, #stack_resources, #status, #task_definition_arns, #waf_client

Instance Method Details

#stack_output(name) ⇒ Object



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

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_config_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