Skip to content

Commit c8d95df

Browse files
authored
Merge pull request #386 from redterror/feat/support-non-camel-output-names
2 parents e723725 + 6f09f76 commit c8d95df

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

lib/stack_master/parameter_resolvers/stack_output.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def resolve(value)
1818
region, stack_name, output_name = parse!(value)
1919
stack = find_stack(stack_name, region)
2020
if stack
21-
output = stack.outputs.find { |stack_output| stack_output.output_key == output_name.camelize }
21+
output = stack.outputs.find { |stack_output| stack_output.output_key == output_name.camelize || stack_output.output_key == output_name }
2222
if output
2323
output.output_value
2424
else

spec/stack_master/parameter_resolvers/stack_output_spec.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,15 @@ def resolve(value)
6767
resolver.resolve("ap-southeast-2:#{value}")
6868
end
6969

70+
context 'when the output key has a non-camel name' do
71+
let(:value) { 'my-stack/my_Output' }
72+
let(:outputs) { [{output_key: 'my_Output', output_value: 'myresolvedvalue'}] }
73+
74+
it 'resolves the value' do
75+
expect(resolved_value).to eq 'myresolvedvalue'
76+
end
77+
end
78+
7079
context "when different credentials are used" do
7180
let(:outputs_in_account_2) { [ {output_key: 'MyOutput', output_value: 'resolvedvalueinaccount2'} ] }
7281
let(:stacks_in_account_2) { [{ stack_name: 'other-stack', creation_time: Time.now, stack_status: 'CREATE_COMPLETE', outputs: outputs_in_account_2}] }

0 commit comments

Comments
 (0)