(cdk): Support for infrastructure and code stacks as peer stacks #20853
SamStephens
started this conversation in
General
Replies: 1 comment
-
The common pattern with CDK is that you keep the resources (assets, code, etc.) that are relevant to a specific area of your broader infrastructure within one stack. This could be one service, one aspect of a service, or some other discrete unit of deployment. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the issue
I'm trying to use the classic pattern where you have an infrastructure stack and a code stack. I want to define these two stacks as peer stacks, and directly reference resources in the infrastructure stack from the code stack. When I started doing this, I quickly encountered a cyclic reference error that I've opened a separate bug issue for.
However I'm wanting to know whether this is a usage pattern that the CDK team support in general, and whether the CDK consider this poor practice or good practice; before I commit to it and then potentially find I'm stuck because I'm using the CDK in an unsupported fashion.
I'm not interested in using nested stacks for this. When I worked with Nested Stacks back when I was an AWS employee I found them quite clunky to work with, although this was a few years ago.
I'm currently using peer stacks, with the infrastructure stack exporting resource ARNs using CfnOutput, and the code stack then importing them using Fn.importValue. But it would be cleaner if I could safely pass the actual CDK constructs from the infrastructure stack to the code stack.
Links
https://docs.aws.amazon.com/cdk/v2/guide/stacks.html
Beta Was this translation helpful? Give feedback.
All reactions