Can I have a Stack that only deploys in certain en...
# help
j
Can I have a Stack that only deploys in certain envs - either whitelist or blacklist? My usecase is that I need to stand up a dummy API to mock out an external integration and I want to deploy that in environments except prod, staging etc.
o
Yeah I just wrap the stack instantiation in the index.ts with an if statement
Copy code
if (app.stage === 'prod') {
    new CustomerLedger(app, 'test-customer', 'test');
    // ...other customers
  } else if (app.stage === 'dev') {
    new CustomerLedger(
      app,
      'fragment-engineering',
      'fragment-eng-test',
      false // We don't want local test runs writing to the event bus
    );
  }
j
Thanks, that'll do!