-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Description
What is the problem?
CDK CLI shows confusing, sometimes misleading, output when synthesizing a CDK app with a Stage containing stacks.
Reproduction Steps
Put this app in a CDK app project:
import * as cdk from 'aws-cdk-lib';
import { Construct } from 'constructs';
class MyStage extends cdk.Stage {
constructor(scope: Construct, id: string, props: cdk.StageProps = {}) {
super(scope, id, props);
new cdk.Stack(this, 'One');
new cdk.Stack(this, 'Two');
}
}
const app = new cdk.App();
new MyStage(app, 'Stage');
app.synth();Then run cdk synth. CDK CLI will display this confusing output:
Supply a stack id () to display its template.
If a user saw #14379, they might try to run cdk synth '**'. If they do, the CDK CLI will then supply (misleading?) instructions on how to display the template of one of the stage-embedded stacks, like this:
Successfully synthesized to /home/josh/proj/cdk-foo/cdk.out
Supply a stack id (StageOneF5E336C2, StageTwo81B557F6) to display its template.
Now run cdk synth StageOneF5E336C2 and the CDK CLI will error:
No stacks match the name(s) StageOneF5E336C2
What did you expect to happen?
I expected cdk synth and cdk synth '**' to display the following output because it reflects the next commands I should type to display the right template:
Supply a stack id (Stage/One, Stage/Two) to display its template.
What actually happened?
cdk synth displayed:
Supply a stack id () to display its template.
cdk synth '**' displayed:
Successfully synthesized to /home/josh/proj/cdk-foo/cdk.out
Supply a stack id (StageOneF5E336C2, StageTwo81B557F6) to display its template.
CDK CLI Version
2.8.0 (build 8a5eb49)
Framework Version
2.8.0
Node.js Version
v14.17.6
OS
Linux
Language
Typescript
Language Version
TypeScript (3.9.10)
Other information
Slack discussion here: https://cdk-dev.slack.com/archives/C018XT6REKT/p1642630685122800