Skip to content

(core): diff and deploy print jumbled names for nested stacks but only accept hierarchical name as arguments #18724

@visadb

Description

@visadb

What is the problem?

The cdk command line tool's subcommands diff and deploy print weird jumbled names for nested stacks, eg. MyStackNestedStackABCD1234. Inconsistently, these subcommands only accept slash-separated hierarchical stack names such as MyStack/NestedStack.

This is a pain for example in the following workflow:

  1. run cdk diff
  2. from the output, note a subset of stacks with changes that you want to deploy. These are in format MyStackNestedStackABCD1234, MyStackAnotherNestedStackEF567890
  3. write a deploy command to deploy those stacks: cdk deploy MyStack/NestedStack MyStack/AnotherNestedStack

In step three you have to convert the jumbled names to the slash-separated format. Not a big problem for two stacks, but imagine 15 or 50. If cdk diff printed stack names in the hierarchical slash-separated format, one could simply copy-paste the stack names from cdk diff output.

Reproduction Steps

  1. Create a nested stack (new NestedStack(this, 'NestedStack', {}) within a stack, called MyStack in this example.
  2. run cdk diff

What did you expect to happen?

cdk diff to print the nice hierarchical name: MyStack/NestedStack

What actually happened?

cdk diff prints a jumbled name MyStackNestedStackABCD1234 which is not accepted as an argument by cdk diff or cdk deploy.

CDK CLI Version

2.9.0

Framework Version

2.9.0

Node.js Version

14.16.0

OS

Linux

Language

Typescript

Language Version

TypeScript (4.1.5)

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/coreRelated to core CDK functionalitybugThis issue is a bug.effort/smallSmall work item – less than a day of effortp1

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions