Maybe someone here can help with a CDK problem I a...
# help
c
Maybe someone here can help with a CDK problem I am trying to solve. I am currently moving all my code into a mono repo. At the top level of my stack I specify each stack for each environment and then when I deploy I specify the stack. So my toplevel app looks like this:
Copy code
const app = new <http://cdk.App|cdk.App>();

new BackendStack(app, `BackendStack-dev`, {
...

new FrontendStack(app, `FrontendStack-dev`, {
...

new BackendStack(app, `BackendStack-sandbox`, {
...

new FrontendStack(app, `FrontendStack-sandbox`, {
...
So if I want to deploy to
sandbox
I can do something like this:
Copy code
cdk deploy --require-approval never BackendStack-sandbox 'BackendStack-sandbox/**' FrontendStack-sandbox
The problem is everytime I synth/deploy CDK synths all stacks before dropping them for final output. The issue is that if I have time consuming operations (such as building assets) in my develop stack, I need to wait for them to complete when deploying to my sandbox stack. A solution I have found is to wrap the above constructs in if statements. This works but now I want to use the stack names I passed to cdk deploy. Does anyone know how I can reference this in code? In the example above I would like to get
BackendStack-sandbox 'BackendStack-sandbox/**' FrontendStack-sandbox
. I thought this would appear in the context but I am not seeing it anywhere.
f
Hey @Chad (cysense), this might not be possible. The synth process is done inside a spawned process and the CLI options
BackendStack-sandbox 'BackendStack-sandbox/**' FrontendStack-sandbox
might not be passed into it.