Class: Bora::CfnParamResolver

Inherits:
Object
  • Object
show all
Defined in:
lib/bora/cfn_param_resolver.rb

Instance Method Summary collapse

Constructor Details

#initialize(param) ⇒ CfnParamResolver

Returns a new instance of CfnParamResolver.



5
6
7
# File 'lib/bora/cfn_param_resolver.rb', line 5

def initialize(param)
  @param = param
end

Instance Method Details

#resolveObject



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/bora/cfn_param_resolver.rb', line 9

def resolve
  stack, section, name = @param.split("/")
  if !stack || !section || !name || section != 'outputs'
    raise "Invalid parameter substitution: #{@param}"
  end

  outputs = Stack.new(stack).outputs
  matching_output = outputs.find { |output| output.key == name }
  raise "Output #{name} not found in stack #{stack}" if !matching_output
  matching_output.value
end