Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add integration test and example for using CDK Nested Stacks with Pulumi #298

Merged
merged 3 commits into from
Dec 18, 2024

Conversation

flostadler
Copy link
Contributor

@flostadler flostadler commented Dec 17, 2024

This PR adds an integration test and example for CDK Nested stacks.

Stacked on top of #295
Related to #80

@flostadler
Copy link
Contributor Author

flostadler commented Dec 17, 2024

This change is part of the following stack:

Change managed by git-spice.

@flostadler flostadler marked this pull request as ready for review December 17, 2024 14:26
integration/nested-stacks/index.ts Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😎

@flostadler flostadler force-pushed the add-integration-test-and-example branch from 1b7943c to 762ac8e Compare December 18, 2024 13:49
flostadler added a commit that referenced this pull request Dec 18, 2024
This change adds support for Nested Stacks to `pulumi-cdk`.
In CDK, a nested stack is a CDK stack that you create inside another
stack, known as the parent stack. Users create nested stacks using the
[NestedStack](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.NestedStack.html)
construct.
By using nested stacks, users can organize resources across multiple
stacks. Nested stacks also offer a way around the AWS CloudFormation
500-resource limit for stacks. A nested stack counts as only one
resource in the stack that contains it. However, it can contain up to
500 resources, including additional nested stacks.
While Pulumi doesn't have those limitations, many existing CDK
constructs use nested stacks to get around the CloudFormation
limitations. The EKS cluster construct is one of the most prominent ones
that require nested stacks.

In detail, this change:
- enhances the `AssemblyManifestReader` to support reading nested
stacks.
- introduces a new unique `StackAddress` for elements in the
CloudFormation templates. It combines the stack path (tree path of the
stack) and the stack-local logical ID in order to form an assembly wide
unique address. This is necessary in order to represent a hierarchy of
stacks in the same pulumi program
- adds a new `NestedStackConstruct` component. It is used to namespace
the resources of a NestedStack in order to not run into any issues with
duplicate logical IDs. It achieves this by including the stack path in
the pulumi resource type. The types of parent resources are included in
URNs, meaning all resources parented under the nested stack have their
own unique namespace.
- updates the artifact converter and intrinsics to handle cross stack
references (Parameters & Outputs) for nested stacks

Integration tests and an example are part of
#298 which is part of this PR
stack.
Base automatically changed from flostadler/nested-stacks to main December 18, 2024 14:13
@flostadler flostadler force-pushed the add-integration-test-and-example branch from 762ac8e to 85c8586 Compare December 18, 2024 14:15
@flostadler flostadler requested a review from corymhall December 18, 2024 15:56
@flostadler flostadler self-assigned this Dec 18, 2024
@flostadler flostadler merged commit 569f57a into main Dec 18, 2024
13 checks passed
@flostadler flostadler deleted the add-integration-test-and-example branch December 18, 2024 17:51
@pulumi-bot
Copy link
Contributor

This PR has been shipped in release v1.4.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants