Hi, I’m creating a `AppConfig stack` which will ne...
# help
Hi, I’m creating a
AppConfig stack
which will need to access every other stack’s output values. The only way I see to do this with SST is by returning the outputs in every stack, then importing them all one by one in the
stack and then accessing the exported values. Is there any way to make this dynamic like accessing every stack deployed from a loop inside the AppConfig stack? My intention is to create a configuration with certain values from each stack so it can be used later from Lambda functions and such
I would suggest reconsidering this, it's a pattern that's going to cause trouble as you now have a stack that is dependent on 100% of other stacks
makes moving things around/tearing things down very tricky
Instead of making it a stack you could just make it a function that returns an object
but I also think centralizing this isn't a great idea but up to you
Hmmm I’m not sure I follow. What would be your approach about creating a “config file” then? I mean, let’s say certain parameters of different stacks would need to be used by lambda functions down the road. Like for example accessing specific table names, glue jobs and stuff. I mean needing those values at runtime
Are you suggesting that every stack should contribute to the AppConfig service with their information instead of centralizing everything on a single stack?
Yeah the stacks could push the values to the center place. But you can also use things like
to load defaults progressively
but in general it's really better to not have a centralized config, it's tempting at first because it feels like it reduces boiler plate but the explicitness offers more flexibility
we are going to solve your use case when we add
as you can see from this prototype: https://github.com/serverless-stack/serverless-stack/blob/master/examples/parameter-prototype/stacks/MyStack.ts but even here we don't have a central place. hard to maintain things like typesafety when doing so
I see. The service I’m trying to use to create the config is this: https://docs.aws.amazon.com/appconfig/latest/userguide/what-is-appconfig.html The idea is that you build your
appconfig "file"
in aws and you can access your configuration parameters at runtime
I guess when the Parameter functionality is implemented I could give it a try and maybe switch from centralized to this approach. Thank you. I’ll be paying attention to the prototype!