-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.ts
37 lines (28 loc) · 1.04 KB
/
app.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { App } from 'aws-cdk-lib'
import { Config } from './Config'
import { InfraStack } from './infra/stack'
import { ServicesStack } from './services/infra/stack'
const configName = process.argv[2]
const config: Config = (await import(`./config.${configName}.ts`)).config
if(!config) throw new Error(`config not set. configName: ${configName}`)
const app = new App()
new InfraStack(app, 'InfraStack', {
env: {
account: process.env.CDK_DEFAULT_ACCOUNT,
region: config.region
},
stackName: 'shepherd-infra-stack',
description: 'shepherd main infrastructure stack. network, rds, etc.',
config,
})
new ServicesStack(app, 'ServicesStack', {
env: { account: process.env.CDK_DEFAULT_ACCOUNT, region: process.env.CDK_DEFAULT_REGION },
stackName: 'shepherd-services',
description: 'Shepherd services stack: ecs, lambdas, etc',
config,
})
/** addons. these get imported a little differently as they don't use classes. */
for(const addon of config.addons){
const { createStack } = await import(`./addons/${addon}/infra/stack`)
createStack(app, config)
}