diff --git a/packages/aws-cdk/bin/cdk.ts b/packages/aws-cdk/bin/cdk.ts index ef82eedbfe31e..a552e8a847f7e 100644 --- a/packages/aws-cdk/bin/cdk.ts +++ b/packages/aws-cdk/bin/cdk.ts @@ -366,6 +366,10 @@ async function initCommandLine() { async function cliDestroy(stackNames: string[], force: boolean, roleArn: string | undefined) { const stacks = await appStacks.selectStacks(...stackNames); + + // The stacks will have been ordered for deployment, so reverse them for deletion. + stacks.reverse(); + renames.validateSelectedStacks(stacks); if (!force) { diff --git a/packages/aws-cdk/integ-tests/app/app.js b/packages/aws-cdk/integ-tests/app/app.js index c07d5a43551c1..28c231e442326 100644 --- a/packages/aws-cdk/integ-tests/app/app.js +++ b/packages/aws-cdk/integ-tests/app/app.js @@ -33,6 +33,8 @@ class IamStack extends cdk.Stack { class ProvidingStack extends cdk.Stack { constructor(parent, id) { super(parent, id); + + new sns.Topic(this, 'BogusTopic'); // Some filler } } @@ -40,6 +42,8 @@ class ConsumingStack extends cdk.Stack { constructor(parent, id, providingStack) { super(parent, id); + + new sns.Topic(this, 'BogusTopic'); // Some filler new cdk.Output(this, 'IConsumedSomething', { value: providingStack.stackName }); } } diff --git a/packages/aws-cdk/integ-tests/test-cdk-order.sh b/packages/aws-cdk/integ-tests/test-cdk-order.sh index 9aa46451fbcfa..410f1adc90478 100755 --- a/packages/aws-cdk/integ-tests/test-cdk-order.sh +++ b/packages/aws-cdk/integ-tests/test-cdk-order.sh @@ -6,10 +6,10 @@ source ${scriptdir}/common.bash setup -# ls order == synthesis order == provider before consumer -assert "cdk list | grep -- -order-" <