A way to create "linked" stacks
See original GitHub issueI have a main stack that stores some essential information such as vpcId, loadBalancerArn, ecsClusterName etc in SSM Parameter Store. In other completely separate stacks, I would like to read these values from SSM and deploy new things on top of the VPC, ECS etc via those params, but I haven’t found a good way to do it.
Generally, if I try to use the fromAttributes
functions of the different modules to get the resources the first stack created, I get very ridiculous requirements to be able to fetch a resource. For example, when I want to fetch a VPC with a VPC ID, I get asked to also provide subnets and AZs (logged bug here) and I see the same with pretty much all the other resources I have tried so far. If I try to use the fromLookup
functions - that actually return a resource when provided its unique identifier - using values from SSM that are only resolved at deploy time, I get this error: All arguments to look up a load balancer must be concrete (no Tokens)
.
What’s the best approach to solve this issue? Or are we not meant to link stacks like this with CDK?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:9 (3 by maintainers)
Top GitHub Comments
Hi @mimozell,
You can link stacks by passing props through the constructors of the stacks. Check out this link to get a good idea of how to accomplish this. Let me know if this answers your question or if you need any additional help with this!
⚠️COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.