Using output of nested stacks in other nested stacks?
See original GitHub issueI’m building my own stacks for my API and was going along great building 1 stack per dynamodb table, essentially – 1 stack per data source since all of my basic resolvers operated on only a single data source.
However now I’m trying to include my pipeline resolvers - which include functions that reference various data sources. I thought I would be able to get the function ids out of their stacks as Output
properties – but the problem is the nested stacks get created in an unpredictable order so it’s a race condition if the output exists by the time I try to reference it.
I don’t see a way to determine this order or tell a stack that it depends on another stack. My solution for now is to just put all of these things into 1 big stack which isn’t great for maintainability.
I also tried adding a custom stack as explained in the docs and make it depend on my api stack but my problem there is I think the service
still needs to be AppSync
– which seemed to basically just not work. Any advice or am I stuck for now with 1 big stack?
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (7 by maintainers)
@chadkouse: most straightforward way to go is using Fn::ImportValue. For short, your nested stack outputs have extra property:
Export
that define export name. Those exported values are available globally within a aws region (you can see all exported values in CloudFormation console). They can latter be thrown in any other stack withFn::ImportValue
, hope this helpsThis issue has been automatically locked since there hasn’t been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server
*-help
channels for those types of questions.