-
Notifications
You must be signed in to change notification settings - Fork 32
/
sample-cfn-vpc-stack.ts
31 lines (24 loc) · 1.01 KB
/
sample-cfn-vpc-stack.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
import * as ec2 from 'aws-cdk-lib/aws-ec2';
import * as cfn_inc from 'aws-cdk-lib/cloudformation-include';
import * as base from '../../lib/template/stack/cfn/cfn-include-stack';
import { Override } from '../../lib/template/stack/base/base-stack';
import { AppContext } from '../../lib/template/app-context';
import { StackConfig } from '../../lib/template/app-config'
export class SampleCfnVpcStack extends base.CfnIncludeStack {
constructor(appContext: AppContext, stackConfig: StackConfig) {
super(appContext, stackConfig);
}
@Override
onLoadTemplateProps(): base.CfnTemplateProps | undefined {
return {
templatePath: this.stackConfig.TemplatePath,
parameters: this.stackConfig.Parameters
};
}
@Override
onPostConstructor(cfnTemplate?: cfn_inc.CfnInclude) {
const cfnVpc = cfnTemplate?.getResource('VPC') as ec2.CfnVPC;
const vpcName = this.stackConfig.Parameters[0]['Value'];
this.putVariable('VpcName', vpcName);
}
}