-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmain.ts
51 lines (43 loc) · 1.59 KB
/
main.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env node
import 'source-map-support/register';
import { App } from '@aws-cdk/core';
import { AccountPrincipal } from '@aws-cdk/aws-iam';
import { AppCosmosStack, AppGalaxyStack, AppSolarSystemStack, AppCiCdSolarSystemStack } from '../lib';
// Cdk App
export const app = new App();
// AWS Env Config
const mgtEnvConfig = { account: '1111', region: 'ap-southeast-2' };
const devEnvConfig = { account: '2222', region: 'ap-southeast-2' };
// Extend the Cosmos + Add our App bits
const cosmos = new AppCosmosStack(app, 'Demo', {
env: mgtEnvConfig,
});
// Extend the Mgt Galaxy
const mgtGalaxy = new AppGalaxyStack(cosmos, 'Mgt');
// Extend the CiCd SolarSystem, adding our App CiCd pipeline
const ciCd = new AppCiCdSolarSystemStack(mgtGalaxy);
// Extends the Dev Galaxy
const devGalaxy = new AppGalaxyStack(cosmos, 'Dev', {
env: devEnvConfig,
});
// Allow the Dev Galaxy to access the ecr repo
cosmos.ecrRepo.grantPull(new AccountPrincipal(devGalaxy.account));
// Extend the Dev SolarSystem, by creating service
const dev = new AppSolarSystemStack(devGalaxy, 'Dev', {
appVersion: process.env.APP_BUILD_VERSION,
});
// Add a Deployment stage in App Pipeline to target this SolarSystem
ciCd.addCdkDeployEnvStageToCodePipeline({
name: 'DeployDev',
stacks: [dev],
isManualApprovalRequired: false,
});
// Extend the Dev SolarSystem, by creating service
const tst = new AppSolarSystemStack(devGalaxy, 'Tst', {
appVersion: process.env.APP_BUILD_VERSION,
});
// Add a Deployment stage in App Pipeline to target this SolarSystem
ciCd.addCdkDeployEnvStageToCodePipeline({
name: 'DeployTst',
stacks: [tst],
});