-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsvcs.ts
37 lines (32 loc) · 1.29 KB
/
svcs.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
import { CfnOutput, RemovalPolicy, Stack, StackProps } from 'aws-cdk-lib';
import * as lambda from 'aws-cdk-lib/aws-lambda';
import * as dynamodb from 'aws-cdk-lib/aws-dynamodb';
import * as s3 from 'aws-cdk-lib/aws-s3';
import { Construct } from 'constructs';
import SharedProps from './SharedProps';
import { MicroAppsAppRelease } from '@pwrdrvr/microapps-app-release-cdk';
import { Env } from './Types';
export interface ISvcsProps extends StackProps {
local: {
appName: string;
};
shared: SharedProps;
}
export class SvcsStack extends Stack {
constructor(scope: Construct, id: string, props: ISvcsProps) {
super(scope, id, props);
const { appName } = props.local;
const { shared } = props;
const app = new MicroAppsAppRelease(this, 'app', {
functionName: `microapps-app-${appName}${shared.envSuffix}${shared.prSuffix}`,
table: dynamodb.Table.fromTableName(this, 'apps-table', shared.tableName),
nodeEnv: shared.env as Env,
removalPolicy: shared.isPR ? RemovalPolicy.DESTROY : RemovalPolicy.RETAIN,
});
// Export the latest version published
new CfnOutput(this, 'app-latest-version', {
value: app.lambdaFunction.latestVersion.version,
exportName: `microapps-app-version-${appName}${shared.envSuffix}${shared.prSuffix}`,
});
}
}