Skip to content

Commit

Permalink
fix(cli): stack outputs aren't sorted (#10328)
Browse files Browse the repository at this point in the history
When running `cdk deploy` the stack outputs to the terminal are currently returned in the same order as the `describe stacks` API call, which does not seem to provide a contract on ordering, per the [docs](https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_Stack.html).

This change sorts the keys of the stack outputs before display, which is consistent with "outputs" tab in the AWS CloudFormation console.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
allanlw authored Sep 21, 2020
1 parent 08a3c55 commit 9f430fc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/aws-cdk/lib/cdk-toolkit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export class CdkToolkit {
stackOutputs[stack.stackName] = result.outputs;
}

for (const name of Object.keys(result.outputs)) {
for (const name of Object.keys(result.outputs).sort()) {
const value = result.outputs[name];
print('%s.%s = %s', colors.cyan(stack.id), colors.cyan(name), colors.underline(colors.cyan(value)));
}
Expand Down

0 comments on commit 9f430fc

Please sign in to comment.