cdklabs / cdklabs/cdk-stacksets
Support NestedStack inside StackSetStack
- Dominant language
- TypeScript
- Stars
- 118
- Forks
- 25
- Avg merge
- 33m
- Merged PRs (30d)
- 4
Description
Like the title says, if you specify a stack inside a StackSetStack, then the Stack doesn't get deployed. (or it can, using the `--all` flag but then it only gets deployed to the primary region as its own stack and not all target regions).
Here is an example of code that works for deploying a bucket to all regions:
```
const app = new App();
const stack = new Stack(app);
const stackSetStack = new StackSetStack(stack, "StackSetStack");
new Bucket(stackSetStack, "Bucket");
new StackSet(stack, 'StackSet', {
target: StackSetTarget.fromAccounts({
regions: ['eu-west-1', 'eu-west-2'],
accounts: [process.env.CDK_DEFAULT_ACCOUNT!],
}),
template: StackSetTemplate.fromStackSetStack(stackSetStack),
});
```
As expected this deploys all the resources (a bucket in this case) to all the regions.
However, if you add a stack between the bucket and the StackSetStack, it no longer deploys the bucket to the all regions, e.g.
```
const app = new App();
const stack = new Stack(app);
const stackSetStack = new StackSetStack(stack, "StackSetStack");
const subStack = new Stack(stackSetStack, "SubStack");
new Bucket(subStack, "Bucket");
new StackSet(stack, 'StackSet', {
target: StackSetTarget.fromAccounts({
regions: ['eu-west-1', 'eu-west-2'],
accounts: [process.env.CDK_DEFAULT_ACCOUNT!],
}),
template: StackSetTemplate.fromStackSetStack(stackSetStack),
});
```
My expected behaviour would be that this deploys the stack to all regions and all regions subsequently deploy a bucket.
Please correct me if I'm wrong.
Contributor guide
Research direction
Start by reproducing the nested-stack example using StackSetStack, Stack, Bucket, and StackSetTemplate.fromStackSetStack. Trace how the template is assembled when a Stack is nested inside StackSetStack, then verify that the nested stack and its bucket are deployed to every configured target region.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 62/100