Class: Bora::CfnParamResolver
- Inherits:
-
Object
- Object
- Bora::CfnParamResolver
- Defined in:
- lib/bora/cfn_param_resolver.rb
Instance Method Summary collapse
-
#initialize(param) ⇒ CfnParamResolver
constructor
A new instance of CfnParamResolver.
- #resolve ⇒ Object
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
#resolve ⇒ Object
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 |