Skip to content

Commit

Permalink
Support non-camel-case stack outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
redterror committed Jul 31, 2024
1 parent e723725 commit 6f09f76
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 6f09f76

Please sign in to comment.