Skip to content

Commit

Permalink
Merge pull request #386 from redterror/feat/support-non-camel-output-…
Browse files Browse the repository at this point in the history
…names
  • Loading branch information
orien authored Jul 31, 2024
2 parents e723725 + 6f09f76 commit c8d95df
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/stack_master/parameter_resolvers/stack_output.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def resolve(value)
region, stack_name, output_name = parse!(value)
stack = find_stack(stack_name, region)
if stack
output = stack.outputs.find { |stack_output| stack_output.output_key == output_name.camelize }
output = stack.outputs.find { |stack_output| stack_output.output_key == output_name.camelize || stack_output.output_key == output_name }
if output
output.output_value
else
Expand Down
9 changes: 9 additions & 0 deletions spec/stack_master/parameter_resolvers/stack_output_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,15 @@ def resolve(value)
resolver.resolve("ap-southeast-2:#{value}")
end

context 'when the output key has a non-camel name' do
let(:value) { 'my-stack/my_Output' }
let(:outputs) { [{output_key: 'my_Output', output_value: 'myresolvedvalue'}] }

it 'resolves the value' do
expect(resolved_value).to eq 'myresolvedvalue'
end
end

context "when different credentials are used" do
let(:outputs_in_account_2) { [ {output_key: 'MyOutput', output_value: 'resolvedvalueinaccount2'} ] }
let(:stacks_in_account_2) { [{ stack_name: 'other-stack', creation_time: Time.now, stack_status: 'CREATE_COMPLETE', outputs: outputs_in_account_2}] }
Expand Down

0 comments on commit c8d95df

Please sign in to comment.