(core): Nested Stacks have a crazy logical ID
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### What is the problem?
Recently, we found out the construct id of the nested stack occurred twice in its logical id.
For example:
```ts
##### Parent infra stack #####
this.fdLifecycleCommonLambdas = new MyNestedStackConstruct(this, "MyNestedStackConstruct", {
...
});
#### Nested stack #####
export class MyNestedStackConstruct extends NestedStack {
...
constructor(parent: Construct, name: string, props: FdLifecycleCommonLambdasProps) {
super(parent, name);
}
...
}
```
```
#### Generated template ####
...
"Resources": {
"MyNestedStackConstructNestedStackMyNestedStackConstructNestedStackResource3E193B32": {
^^^^^^^^^^^ oh no ^^^^^^^^^^^^^^^^^^^^^^^
"Type": "AWS::CloudFormation::Stack",
"Properties": {}
...
}
```
Caused by the code here:
https://github.com/aws/aws-cdk/blob/2b6c2dadc039f7c4255f6864386ba1dd28b6fc4f/packages/%40aws-cdk/core/lib/nested-stack.ts#L123-L133
Contributor guide
Assessment
This issue has not been assessed yet.