-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcdk-main.ts
27 lines (23 loc) · 1.23 KB
/
cdk-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
#!/usr/bin/env node
import 'source-map-support/register';
import * as cdk from 'aws-cdk-lib';
import * as kms from 'aws-cdk-lib/aws-kms';
//import * as blueprints from '@aws-quickstart/eks-blueprints';
const app = new cdk.App();
const stack_config: cdk.StackProps = {
env: {
account: process.env.CDK_DEFAULT_ACCOUNT!, //<-- process.env pulls value from CLI env,
region: process.env.CDK_DEFAULT_REGION! //<-- ! after var, tells TS it won't be null.
}
}
const stack = new cdk.Stack(app, "bug-32368", stack_config);
const kmsKeyAlias: string = "alias/bug/32368"; //in Web Console it'll show as bug/32368
if (kms.Key.isLookupDummy(kms.Key.fromLookup(stack, "pre-existing-kms-key", { aliasName: kmsKeyAlias, returnDummyKeyOnMissing: true }))){
console.log("detected kms isn't pre-existing, will create it.");
// eksBlueprint.resourceProvider(blueprints.GlobalResources.KmsKey, new blueprints.CreateKmsKeyProvider(
// kmsKeyAlias, {description: "cdk generated kms key, used to encrypt etcd and ebs-csi-driver provisioned volumes"}));
}
else {
console.log("detected pre-existing kms, will reuse it.");
// eksBlueprint.resourceProvider(blueprints.GlobalResources.KmsKey, new blueprints.LookupKmsKeyProvider(this.config.kmsKeyAlias));
}