@gradientedge/cdk-utils 9.10.0 → 9.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/lib/aws/common/construct.d.ts +3 -8
- package/dist/src/lib/aws/common/construct.js +3 -14
- package/dist/src/lib/aws/common/resource-name-formatter.d.ts +13 -0
- package/dist/src/lib/aws/common/resource-name-formatter.js +26 -0
- package/dist/src/lib/aws/construct/api-to-any-target/main.js +1 -1
- package/dist/src/lib/aws/construct/api-to-eventbridge-target/main.js +7 -6
- package/dist/src/lib/aws/construct/api-to-eventbridge-target-with-sns/main.js +2 -2
- package/dist/src/lib/aws/construct/api-to-lambda-target/main.js +2 -2
- package/dist/src/lib/aws/construct/application-configuration/main.js +1 -1
- package/dist/src/lib/aws/construct/lambda-with-iam-access/main.js +3 -3
- package/dist/src/lib/aws/construct/site-with-ecs-backend/main.js +7 -7
- package/dist/src/lib/aws/construct/site-with-lambda-backend/main.js +3 -3
- package/dist/src/lib/aws/services/api-gateway/main.js +1 -1
- package/dist/src/lib/aws/services/appconfig/main.js +2 -2
- package/dist/src/lib/aws/services/cloudfront/main.js +2 -2
- package/dist/src/lib/aws/services/cloudtrail/main.js +1 -1
- package/dist/src/lib/aws/services/dynamodb/main.js +1 -1
- package/dist/src/lib/aws/services/elastic-container-service/main.js +2 -2
- package/dist/src/lib/aws/services/elastic-file-system/main.js +1 -1
- package/dist/src/lib/aws/services/elastic-kubernetes-service/main.js +1 -1
- package/dist/src/lib/aws/services/elasticache/main.js +1 -1
- package/dist/src/lib/aws/services/eventbridge/main.js +13 -9
- package/dist/src/lib/aws/services/evidently/main.js +4 -4
- package/dist/src/lib/aws/services/identity-access-management/main.js +10 -10
- package/dist/src/lib/aws/services/lambda/main.js +2 -2
- package/dist/src/lib/aws/services/secrets-manager/main.js +1 -1
- package/dist/src/lib/aws/services/simple-notification-service/main.js +4 -4
- package/dist/src/lib/aws/services/simple-queue-service/main.js +1 -1
- package/dist/src/lib/aws/services/simple-storage-service/main.js +1 -1
- package/dist/src/lib/aws/services/step-function/main.js +1 -1
- package/dist/src/lib/aws/services/virtual-private-cloud/main.js +3 -3
- package/dist/src/lib/aws/services/web-application-firewall/main.js +2 -2
- package/package.json +2 -2
- package/src/lib/aws/common/construct.ts +4 -16
- package/src/lib/aws/common/resource-name-formatter.ts +26 -0
- package/src/lib/aws/construct/api-to-any-target/main.ts +1 -1
- package/src/lib/aws/construct/api-to-eventbridge-target/main.ts +7 -6
- package/src/lib/aws/construct/api-to-eventbridge-target-with-sns/main.ts +2 -2
- package/src/lib/aws/construct/api-to-lambda-target/main.ts +2 -2
- package/src/lib/aws/construct/application-configuration/main.ts +1 -1
- package/src/lib/aws/construct/lambda-with-iam-access/main.ts +3 -3
- package/src/lib/aws/construct/site-with-ecs-backend/main.ts +9 -7
- package/src/lib/aws/construct/site-with-lambda-backend/main.ts +5 -3
- package/src/lib/aws/services/api-gateway/main.ts +1 -1
- package/src/lib/aws/services/appconfig/main.ts +2 -2
- package/src/lib/aws/services/cloudfront/main.ts +2 -2
- package/src/lib/aws/services/cloudtrail/main.ts +1 -1
- package/src/lib/aws/services/dynamodb/main.ts +1 -1
- package/src/lib/aws/services/elastic-container-service/main.ts +2 -2
- package/src/lib/aws/services/elastic-file-system/main.ts +1 -1
- package/src/lib/aws/services/elastic-kubernetes-service/main.ts +1 -1
- package/src/lib/aws/services/elasticache/main.ts +1 -1
- package/src/lib/aws/services/eventbridge/main.ts +13 -9
- package/src/lib/aws/services/evidently/main.ts +4 -4
- package/src/lib/aws/services/identity-access-management/main.ts +10 -10
- package/src/lib/aws/services/lambda/main.ts +2 -2
- package/src/lib/aws/services/secrets-manager/main.ts +1 -1
- package/src/lib/aws/services/simple-notification-service/main.ts +4 -4
- package/src/lib/aws/services/simple-queue-service/main.ts +1 -1
- package/src/lib/aws/services/simple-storage-service/main.ts +1 -1
- package/src/lib/aws/services/step-function/main.ts +1 -1
- package/src/lib/aws/services/virtual-private-cloud/main.ts +3 -3
- package/src/lib/aws/services/web-application-firewall/main.ts +2 -2
|
@@ -416,10 +416,10 @@ class IamManager {
|
|
|
416
416
|
policies: [
|
|
417
417
|
{
|
|
418
418
|
policyDocument: policy,
|
|
419
|
-
policyName: scope.resourceNameFormatter(`${id}-policy`),
|
|
419
|
+
policyName: scope.resourceNameFormatter.format(`${id}-policy`),
|
|
420
420
|
},
|
|
421
421
|
],
|
|
422
|
-
roleName: scope.resourceNameFormatter(id),
|
|
422
|
+
roleName: scope.resourceNameFormatter.format(id),
|
|
423
423
|
});
|
|
424
424
|
(0, utils_1.createCfnOutput)(`${id}Arn`, scope, role.attrArn);
|
|
425
425
|
(0, utils_1.createCfnOutput)(`${id}Name`, scope, role.roleName);
|
|
@@ -440,7 +440,7 @@ class IamManager {
|
|
|
440
440
|
assumedBy: new aws_iam_1.ServicePrincipal('events.amazonaws.com'),
|
|
441
441
|
description: `Role for ${id} ECS Task execution from EventBridge`,
|
|
442
442
|
inlinePolicies: { policy },
|
|
443
|
-
roleName: scope.resourceNameFormatter(id),
|
|
443
|
+
roleName: scope.resourceNameFormatter.format(id),
|
|
444
444
|
});
|
|
445
445
|
(0, utils_1.createCfnOutput)(`${id}Arn`, scope, role.roleArn);
|
|
446
446
|
(0, utils_1.createCfnOutput)(`${id}Name`, scope, role.roleName);
|
|
@@ -460,7 +460,7 @@ class IamManager {
|
|
|
460
460
|
managedPolicies: [
|
|
461
461
|
aws_iam_1.ManagedPolicy.fromManagedPolicyArn(scope, `${id}-AmazonECSTaskExecutionRolePolicy`, 'arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy'),
|
|
462
462
|
],
|
|
463
|
-
roleName: scope.resourceNameFormatter(id),
|
|
463
|
+
roleName: scope.resourceNameFormatter.format(id),
|
|
464
464
|
});
|
|
465
465
|
(0, utils_1.createCfnOutput)(`${id}Arn`, scope, role.roleArn);
|
|
466
466
|
(0, utils_1.createCfnOutput)(`${id}Name`, scope, role.roleName);
|
|
@@ -481,7 +481,7 @@ class IamManager {
|
|
|
481
481
|
managedPolicies: [
|
|
482
482
|
aws_iam_1.ManagedPolicy.fromManagedPolicyArn(scope, `${id}-AWSLambdaBasicExecutionRole`, 'arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole'),
|
|
483
483
|
],
|
|
484
|
-
roleName: scope.resourceNameFormatter(id),
|
|
484
|
+
roleName: scope.resourceNameFormatter.format(id),
|
|
485
485
|
});
|
|
486
486
|
(0, utils_1.createCfnOutput)(`${id}Arn`, scope, role.roleArn);
|
|
487
487
|
(0, utils_1.createCfnOutput)(`${id}Name`, scope, role.roleName);
|
|
@@ -499,7 +499,7 @@ class IamManager {
|
|
|
499
499
|
assumedBy: servicePrincipal ?? new aws_iam_1.ServicePrincipal('appconfig.amazonaws.com'),
|
|
500
500
|
description: `Role for ${id} AppConfig Secrets`,
|
|
501
501
|
inlinePolicies: { policy },
|
|
502
|
-
roleName: scope.resourceNameFormatter(id),
|
|
502
|
+
roleName: scope.resourceNameFormatter.format(id),
|
|
503
503
|
});
|
|
504
504
|
(0, utils_1.createCfnOutput)(`${id}Arn`, scope, role.roleArn);
|
|
505
505
|
(0, utils_1.createCfnOutput)(`${id}Name`, scope, role.roleName);
|
|
@@ -520,7 +520,7 @@ class IamManager {
|
|
|
520
520
|
managedPolicies: [
|
|
521
521
|
aws_iam_1.ManagedPolicy.fromManagedPolicyArn(scope, `${id}-AWSLambdaBasicExecutionRole`, 'arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole'),
|
|
522
522
|
],
|
|
523
|
-
roleName: scope.resourceNameFormatter(id),
|
|
523
|
+
roleName: scope.resourceNameFormatter.format(id),
|
|
524
524
|
});
|
|
525
525
|
(0, utils_1.createCfnOutput)(`${id}Arn`, scope, role.roleArn);
|
|
526
526
|
(0, utils_1.createCfnOutput)(`${id}Name`, scope, role.roleName);
|
|
@@ -537,7 +537,7 @@ class IamManager {
|
|
|
537
537
|
const role = new aws_iam_1.Role(scope, `${id}`, {
|
|
538
538
|
assumedBy: new aws_iam_1.ServicePrincipal('pipes.amazonaws.com'),
|
|
539
539
|
description: `Role for ${id} Pipe`,
|
|
540
|
-
roleName: scope.resourceNameFormatter(id),
|
|
540
|
+
roleName: scope.resourceNameFormatter.format(id),
|
|
541
541
|
});
|
|
542
542
|
role.addToPolicy(this.statementForPollQueue([queueArn]));
|
|
543
543
|
role.addToPolicy(this.statementForStartExecution([stepFunctionArn]));
|
|
@@ -556,7 +556,7 @@ class IamManager {
|
|
|
556
556
|
const role = new aws_iam_1.Role(scope, `${id}`, {
|
|
557
557
|
assumedBy: new aws_iam_1.ServicePrincipal('pipes.amazonaws.com'),
|
|
558
558
|
description: `Role for ${id} Pipe`,
|
|
559
|
-
roleName: scope.resourceNameFormatter(id),
|
|
559
|
+
roleName: scope.resourceNameFormatter.format(id),
|
|
560
560
|
});
|
|
561
561
|
role.addToPolicy(this.statementForPollQueue([queueArn]));
|
|
562
562
|
role.addToPolicy(this.statementForInvokeLambda([lambdaArn]));
|
|
@@ -600,7 +600,7 @@ class IamManager {
|
|
|
600
600
|
const role = new aws_iam_1.Role(scope, `${id}`, {
|
|
601
601
|
assumedBy: new aws_iam_1.ServicePrincipal('pipes.amazonaws.com'),
|
|
602
602
|
description: `Role for ${id} Pipe`,
|
|
603
|
-
roleName: scope.resourceNameFormatter(id),
|
|
603
|
+
roleName: scope.resourceNameFormatter.format(id),
|
|
604
604
|
});
|
|
605
605
|
role.addToPolicy(this.statementFordynamoDbStream([dynamoDbStreamArn]));
|
|
606
606
|
role.addToPolicy(this.statementForInvokeLambda([lambdaFunctionArn]));
|
|
@@ -76,7 +76,7 @@ class LambdaManager {
|
|
|
76
76
|
throw `Lambda props undefined for ${id}`;
|
|
77
77
|
if (!props.functionName)
|
|
78
78
|
throw `Lambda functionName undefined for ${id}`;
|
|
79
|
-
const functionName = scope.resourceNameFormatter(props.functionName, props.resourceNameOptions);
|
|
79
|
+
const functionName = scope.resourceNameFormatter.format(props.functionName, props.resourceNameOptions);
|
|
80
80
|
let deadLetterQueue;
|
|
81
81
|
if (props.deadLetterQueueEnabled) {
|
|
82
82
|
const redriveQueue = scope.sqsManager.createRedriveQueueForLambda(`${id}-rdq`, scope, props);
|
|
@@ -181,7 +181,7 @@ class LambdaManager {
|
|
|
181
181
|
throw `Lambda props undefined for ${id}`;
|
|
182
182
|
if (!props.functionName)
|
|
183
183
|
throw `Lambda functionName undefined for ${id}`;
|
|
184
|
-
const functionName = scope.resourceNameFormatter(props.functionName, props.resourceNameOptions);
|
|
184
|
+
const functionName = scope.resourceNameFormatter.format(props.functionName, props.resourceNameOptions);
|
|
185
185
|
let deadLetterQueue;
|
|
186
186
|
if (props.deadLetterQueueEnabled) {
|
|
187
187
|
const redriveQueue = scope.sqsManager.createRedriveQueueForLambda(`${id}-rdq`, scope, props);
|
|
@@ -35,7 +35,7 @@ class SecretsManager {
|
|
|
35
35
|
throw `Secret name undefined for ${id}`;
|
|
36
36
|
const secret = new aws_secretsmanager_1.Secret(scope, `${id}`, {
|
|
37
37
|
...props,
|
|
38
|
-
secretName: scope.resourceNameFormatter(props.secretName, props.resourceNameOptions),
|
|
38
|
+
secretName: scope.resourceNameFormatter.format(props.secretName, props.resourceNameOptions),
|
|
39
39
|
});
|
|
40
40
|
(0, utils_1.createCfnOutput)(`${id}-secretName`, scope, secret.secretName);
|
|
41
41
|
(0, utils_1.createCfnOutput)(`${id}-secretArn`, scope, secret.secretArn);
|
|
@@ -39,8 +39,8 @@ class SnsManager {
|
|
|
39
39
|
throw `Subscription topicName undefined for ${id}`;
|
|
40
40
|
const topic = new aws_sns_1.Topic(scope, id, {
|
|
41
41
|
...props,
|
|
42
|
-
displayName: scope.resourceNameFormatter(props.topicName, props.resourceNameOptions),
|
|
43
|
-
topicName: scope.resourceNameFormatter(props.topicName, props.resourceNameOptions),
|
|
42
|
+
displayName: scope.resourceNameFormatter.format(props.topicName, props.resourceNameOptions),
|
|
43
|
+
topicName: scope.resourceNameFormatter.format(props.topicName, props.resourceNameOptions),
|
|
44
44
|
});
|
|
45
45
|
if (emails && !lodash_1.default.isEmpty(emails)) {
|
|
46
46
|
lodash_1.default.forEach(emails, (email) => topic.addSubscription(new aws_sns_subscriptions_1.EmailSubscription(email)));
|
|
@@ -63,8 +63,8 @@ class SnsManager {
|
|
|
63
63
|
throw `Subscription topicName undefined for ${id}`;
|
|
64
64
|
const topic = new aws_sns_1.Topic(scope, id, {
|
|
65
65
|
...props,
|
|
66
|
-
displayName: scope.resourceNameFormatter(props.topicName, props.resourceNameOptions),
|
|
67
|
-
topicName: scope.resourceNameFormatter(props.topicName, props.resourceNameOptions),
|
|
66
|
+
displayName: scope.resourceNameFormatter.format(props.topicName, props.resourceNameOptions),
|
|
67
|
+
topicName: scope.resourceNameFormatter.format(props.topicName, props.resourceNameOptions),
|
|
68
68
|
});
|
|
69
69
|
topic.addSubscription(new aws_sns_subscriptions_1.LambdaSubscription(lambdaFunction));
|
|
70
70
|
(0, utils_1.createCfnOutput)(`${id}-subscriptionArn`, scope, topic.topicArn);
|
|
@@ -37,7 +37,7 @@ class SqsManager {
|
|
|
37
37
|
throw `Queue props undefined for ${id}`;
|
|
38
38
|
if (!props.queueName)
|
|
39
39
|
throw `Queue queueName undefined for ${id}`;
|
|
40
|
-
let queueName = scope.resourceNameFormatter(props.queueName, props.resourceNameOptions);
|
|
40
|
+
let queueName = scope.resourceNameFormatter.format(props.queueName, props.resourceNameOptions);
|
|
41
41
|
if (props.fifo)
|
|
42
42
|
queueName += '.fifo';
|
|
43
43
|
const queue = new aws_sqs_1.Queue(scope, id, {
|
|
@@ -76,7 +76,7 @@ class S3Manager {
|
|
|
76
76
|
if (!scope.props.excludeAccountNumberForBuckets) {
|
|
77
77
|
return S3Manager.determineBucketNameByAccountAndRegion(scope, bucketName);
|
|
78
78
|
}
|
|
79
|
-
return scope.resourceNameFormatter(bucketName, props.resourceNameOptions);
|
|
79
|
+
return scope.resourceNameFormatter.format(bucketName, props.resourceNameOptions);
|
|
80
80
|
}
|
|
81
81
|
/**
|
|
82
82
|
* @summary Method to create a s3 bucket
|
|
@@ -377,7 +377,7 @@ class SfnManager {
|
|
|
377
377
|
level: props.logs?.level ?? aws_stepfunctions_1.LogLevel.ALL,
|
|
378
378
|
},
|
|
379
379
|
role,
|
|
380
|
-
stateMachineName: scope.resourceNameFormatter(props.stateMachineName, props.resourceNameOptions),
|
|
380
|
+
stateMachineName: scope.resourceNameFormatter.format(props.stateMachineName, props.resourceNameOptions),
|
|
381
381
|
});
|
|
382
382
|
(0, utils_1.createCfnOutput)(`${id}-stateMachineName`, scope, stateMachine.stateMachineName);
|
|
383
383
|
(0, utils_1.createCfnOutput)(`${id}-stateMachineArn`, scope, stateMachine.stateMachineArn);
|
|
@@ -40,7 +40,7 @@ class VpcManager {
|
|
|
40
40
|
throw `Vpc props undefined for ${id}`;
|
|
41
41
|
if (!props.vpcName)
|
|
42
42
|
throw `Vpc vpcName undefined for ${id}`;
|
|
43
|
-
const vpcName = scope.resourceNameFormatter(props.vpcName, props.resourceNameOptions);
|
|
43
|
+
const vpcName = scope.resourceNameFormatter.format(props.vpcName, props.resourceNameOptions);
|
|
44
44
|
let vpc;
|
|
45
45
|
if (props.isIPV6) {
|
|
46
46
|
vpc = new ipv6_1.Ipv6Vpc(scope, `${id}`, {
|
|
@@ -82,9 +82,9 @@ class VpcManager {
|
|
|
82
82
|
* @param vpcIdentifier optional identifier for VPC
|
|
83
83
|
*/
|
|
84
84
|
retrieveCommonVpc(id, scope, vpcIdentifier) {
|
|
85
|
-
const vpcName = scope.resourceNameFormatter(vpcIdentifier ?? CommonVpcIdentifier);
|
|
85
|
+
const vpcName = scope.resourceNameFormatter.format(vpcIdentifier ?? CommonVpcIdentifier);
|
|
86
86
|
return aws_ec2_1.Vpc.fromLookup(scope, `${id}`, {
|
|
87
|
-
vpcName: scope.resourceNameFormatter(vpcIdentifier ?? CommonVpcIdentifier),
|
|
87
|
+
vpcName: scope.resourceNameFormatter.format(vpcIdentifier ?? CommonVpcIdentifier),
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
90
|
}
|
|
@@ -34,7 +34,7 @@ class WafManager {
|
|
|
34
34
|
const ipSet = new aws_wafv2_1.CfnIPSet(scope, `${id}`, {
|
|
35
35
|
...props,
|
|
36
36
|
description: `IP Set for ${id} - ${scope.props.stage} stage`,
|
|
37
|
-
name: scope.resourceNameFormatter(props.name, props.resourceNameOptions),
|
|
37
|
+
name: scope.resourceNameFormatter.format(props.name, props.resourceNameOptions),
|
|
38
38
|
});
|
|
39
39
|
(0, utils_1.createCfnOutput)(`${id}-ipSetId`, scope, ipSet.attrId);
|
|
40
40
|
(0, utils_1.createCfnOutput)(`${id}-ipSetArn`, scope, ipSet.attrArn);
|
|
@@ -54,7 +54,7 @@ class WafManager {
|
|
|
54
54
|
const webAcl = new aws_wafv2_1.CfnWebACL(scope, `${id}`, {
|
|
55
55
|
...props,
|
|
56
56
|
description: `Web Acl for ${id} - ${scope.props.stage} stage`,
|
|
57
|
-
name: scope.resourceNameFormatter(props.name, props.resourceNameOptions),
|
|
57
|
+
name: scope.resourceNameFormatter.format(props.name, props.resourceNameOptions),
|
|
58
58
|
tags: [{ key: 'service', value: scope.props.name }],
|
|
59
59
|
});
|
|
60
60
|
(0, utils_1.createCfnOutput)(`${id}-webAclId`, scope, webAcl.attrId);
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gradientedge/cdk-utils",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.11.0",
|
|
4
4
|
"description": "Utilities for AWS CDK provisioning",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=16 <=20",
|
|
8
|
-
"pnpm": "=
|
|
8
|
+
"pnpm": "=9"
|
|
9
9
|
},
|
|
10
10
|
"packageManager": "pnpm@8.15.8",
|
|
11
11
|
"repository": {
|
|
@@ -33,7 +33,8 @@ import {
|
|
|
33
33
|
WafManager,
|
|
34
34
|
} from '../services'
|
|
35
35
|
import { createCfnOutput } from '../utils'
|
|
36
|
-
import {
|
|
36
|
+
import { ResourceNameFormatter } from './resource-name-formatter'
|
|
37
|
+
import { CommonStackProps } from './types'
|
|
37
38
|
|
|
38
39
|
/**
|
|
39
40
|
* @subcategory Construct
|
|
@@ -50,6 +51,7 @@ import { CommonStackProps, ResourceNameFormatterProps } from './types'
|
|
|
50
51
|
*/
|
|
51
52
|
export class CommonConstruct extends Construct {
|
|
52
53
|
props: CommonStackProps
|
|
54
|
+
resourceNameFormatter: ResourceNameFormatter
|
|
53
55
|
acmManager: AcmManager
|
|
54
56
|
apiManager: ApiManager
|
|
55
57
|
appConfigManager: AppConfigManager
|
|
@@ -85,6 +87,7 @@ export class CommonConstruct extends Construct {
|
|
|
85
87
|
constructor(parent: Construct, id: string, props: CommonStackProps) {
|
|
86
88
|
super(parent, id)
|
|
87
89
|
this.props = props
|
|
90
|
+
this.resourceNameFormatter = new ResourceNameFormatter(this, `${id}-rnf`, props)
|
|
88
91
|
this.acmManager = new AcmManager()
|
|
89
92
|
this.apiManager = new ApiManager()
|
|
90
93
|
this.appConfigManager = new AppConfigManager()
|
|
@@ -118,21 +121,6 @@ export class CommonConstruct extends Construct {
|
|
|
118
121
|
this.determineFullyQualifiedDomain()
|
|
119
122
|
}
|
|
120
123
|
|
|
121
|
-
/**
|
|
122
|
-
* @summary Helper method to format a resource name based on the provided options
|
|
123
|
-
* @param resourceName the resource name to format
|
|
124
|
-
* @param options options to control the formatting of the resource name
|
|
125
|
-
* @returns The formatted resource name
|
|
126
|
-
*/
|
|
127
|
-
public resourceNameFormatter(resourceName: string, options?: ResourceNameFormatterProps) {
|
|
128
|
-
const resourceNameElements = []
|
|
129
|
-
resourceNameElements.push(options?.prefix ?? this.props.resourcePrefix)
|
|
130
|
-
resourceNameElements.push(resourceName)
|
|
131
|
-
resourceNameElements.push(options?.suffix ?? this.props.resourceSuffix)
|
|
132
|
-
resourceNameElements.push(this.props.stage)
|
|
133
|
-
return resourceNameElements.filter(resourceNameElement => resourceNameElement != undefined).join('-')
|
|
134
|
-
}
|
|
135
|
-
|
|
136
124
|
/**
|
|
137
125
|
* @summary Helper method to add CloudFormation outputs from the construct
|
|
138
126
|
* @param id scoped id of the resource
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Construct } from 'constructs'
|
|
2
|
+
import { CommonStackProps, ResourceNameFormatterProps } from './types'
|
|
3
|
+
|
|
4
|
+
export class ResourceNameFormatter extends Construct {
|
|
5
|
+
props: CommonStackProps
|
|
6
|
+
|
|
7
|
+
constructor(parent: Construct, id: string, props: CommonStackProps) {
|
|
8
|
+
super(parent, id)
|
|
9
|
+
this.props = props
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @summary Helper method to format a resource name based on the provided options
|
|
14
|
+
* @param resourceName the resource name to format
|
|
15
|
+
* @param options options to control the formatting of the resource name
|
|
16
|
+
* @returns The formatted resource name
|
|
17
|
+
*/
|
|
18
|
+
public format(resourceName: string, options?: ResourceNameFormatterProps) {
|
|
19
|
+
const resourceNameElements = []
|
|
20
|
+
resourceNameElements.push(options?.prefix ?? this.props.resourcePrefix)
|
|
21
|
+
resourceNameElements.push(resourceName)
|
|
22
|
+
resourceNameElements.push(options?.suffix ?? this.props.resourceSuffix)
|
|
23
|
+
resourceNameElements.push(this.props.stage)
|
|
24
|
+
return resourceNameElements.filter(resourceNameElement => resourceNameElement != undefined).join('-')
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -154,7 +154,7 @@ export class ApiToAnyTarget extends CommonConstruct {
|
|
|
154
154
|
types: [this.isProductionStage() ? EndpointType.EDGE : EndpointType.REGIONAL],
|
|
155
155
|
},
|
|
156
156
|
...this.props.api.restApi,
|
|
157
|
-
restApiName: this.resourceNameFormatter(
|
|
157
|
+
restApiName: this.resourceNameFormatter.format(
|
|
158
158
|
this.props.api.restApi?.restApiName,
|
|
159
159
|
this.props.api.restApi?.resourceNameOptions
|
|
160
160
|
),
|
|
@@ -159,12 +159,12 @@ export class ApiToEventBridgeTarget extends CommonConstruct {
|
|
|
159
159
|
this.apiEvent.eventBus = EventBus.fromEventBusName(
|
|
160
160
|
this,
|
|
161
161
|
`${this.id}-event-bus`,
|
|
162
|
-
|
|
162
|
+
this.resourceNameFormatter.format(this.props.event.eventBusName ?? 'default')
|
|
163
163
|
)
|
|
164
164
|
return
|
|
165
165
|
}
|
|
166
166
|
this.apiEvent.eventBus = this.eventManager.createEventBus(`${this.id}-event-bus`, this, {
|
|
167
|
-
eventBusName:
|
|
167
|
+
eventBusName: this.props.event.eventBusName ?? 'default',
|
|
168
168
|
})
|
|
169
169
|
}
|
|
170
170
|
|
|
@@ -175,7 +175,7 @@ export class ApiToEventBridgeTarget extends CommonConstruct {
|
|
|
175
175
|
if (this.props.api.useExisting) return
|
|
176
176
|
this.apiEvent.logGroup = this.logManager.createLogGroup(`${this.id}-log`, this, {
|
|
177
177
|
...{
|
|
178
|
-
logGroupName: `/${this.id}/events/api-to-eventbridge-target`,
|
|
178
|
+
logGroupName: `/${this.resourceNameFormatter.format(this.id)}/events/api-to-eventbridge-target`,
|
|
179
179
|
},
|
|
180
180
|
...this.props.event.logGroup,
|
|
181
181
|
})
|
|
@@ -186,11 +186,12 @@ export class ApiToEventBridgeTarget extends CommonConstruct {
|
|
|
186
186
|
*/
|
|
187
187
|
protected createApiToEventBridgeTargetRule() {
|
|
188
188
|
if (this.props.api.useExisting) return
|
|
189
|
+
if (!this.props.event.rule.ruleName) throw `Event ruleName undefined for ${this.id}`
|
|
190
|
+
|
|
189
191
|
this.props.event.rule = {
|
|
190
192
|
eventPattern: {
|
|
191
193
|
source: ['api-to-eventbridge-target'],
|
|
192
194
|
},
|
|
193
|
-
ruleName: `${this.id}-api-to-eventbridge-target`,
|
|
194
195
|
...this.props.event.rule,
|
|
195
196
|
}
|
|
196
197
|
this.apiEvent.rule = this.eventManager.createRule(
|
|
@@ -355,7 +356,7 @@ export class ApiToEventBridgeTarget extends CommonConstruct {
|
|
|
355
356
|
`${this.id}-rest-api-access-log`,
|
|
356
357
|
this,
|
|
357
358
|
{
|
|
358
|
-
logGroupName: `/custom/api/${this.id}-rest-api-access`,
|
|
359
|
+
logGroupName: `/custom/api/${this.resourceNameFormatter.format(this.id)}-rest-api-access`,
|
|
359
360
|
removalPolicy: RemovalPolicy.DESTROY,
|
|
360
361
|
}
|
|
361
362
|
)
|
|
@@ -405,7 +406,7 @@ export class ApiToEventBridgeTarget extends CommonConstruct {
|
|
|
405
406
|
types: [EndpointType.REGIONAL],
|
|
406
407
|
},
|
|
407
408
|
...this.props.api.restApi,
|
|
408
|
-
restApiName: this.resourceNameFormatter(
|
|
409
|
+
restApiName: this.resourceNameFormatter.format(
|
|
409
410
|
this.props.api.restApi?.restApiName,
|
|
410
411
|
this.props.api.restApi?.resourceNameOptions
|
|
411
412
|
),
|
|
@@ -362,7 +362,7 @@ export class ApiToEventBridgeTargetWithSns extends CommonConstruct {
|
|
|
362
362
|
`${this.id}-destined-topic`,
|
|
363
363
|
this,
|
|
364
364
|
{
|
|
365
|
-
topicName: this.resourceNameFormatter(`${this.id}-destined-topic`),
|
|
365
|
+
topicName: this.resourceNameFormatter.format(`${this.id}-destined-topic`),
|
|
366
366
|
},
|
|
367
367
|
this.apiDestinedLambda.function
|
|
368
368
|
)
|
|
@@ -538,7 +538,7 @@ export class ApiToEventBridgeTargetWithSns extends CommonConstruct {
|
|
|
538
538
|
types: [EndpointType.REGIONAL],
|
|
539
539
|
},
|
|
540
540
|
...this.props.api,
|
|
541
|
-
restApiName: this.resourceNameFormatter(
|
|
541
|
+
restApiName: this.resourceNameFormatter.format(
|
|
542
542
|
this.props.api.restApi?.restApiName,
|
|
543
543
|
this.props.api.restApi?.resourceNameOptions
|
|
544
544
|
),
|
|
@@ -138,7 +138,7 @@ export class ApiToLambdaTarget extends CommonConstruct {
|
|
|
138
138
|
this.apiToLambdaTargetRestApi.lambda = Function.fromFunctionName(
|
|
139
139
|
this,
|
|
140
140
|
`${this.id}-lambda`,
|
|
141
|
-
this.resourceNameFormatter(this.props.lambdaFunctionName)
|
|
141
|
+
this.resourceNameFormatter.format(this.props.lambdaFunctionName)
|
|
142
142
|
)
|
|
143
143
|
}
|
|
144
144
|
|
|
@@ -156,7 +156,7 @@ export class ApiToLambdaTarget extends CommonConstruct {
|
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
const accessLogGroup = this.logManager.createLogGroup(`${this.id}-rest-api-access-log`, this, {
|
|
159
|
-
logGroupName: `/custom/api/${this.id}-rest-api-access`,
|
|
159
|
+
logGroupName: `/custom/api/${this.resourceNameFormatter.format(this.id)}-rest-api-access`,
|
|
160
160
|
removalPolicy: RemovalPolicy.DESTROY,
|
|
161
161
|
})
|
|
162
162
|
|
|
@@ -79,7 +79,7 @@ export class ApplicationConfiguration extends CommonConstruct {
|
|
|
79
79
|
this.appConfigDeploymentStrategy = new CfnDeploymentStrategy(this, `${this.id}-ac-deployment-strategy`, {
|
|
80
80
|
deploymentDurationInMinutes: this.props.appConfig.deploymentStrategy.deploymentDurationInMinutes,
|
|
81
81
|
growthFactor: this.props.appConfig.deploymentStrategy.growthFactor,
|
|
82
|
-
name: this.props.appConfig.deploymentStrategy.name,
|
|
82
|
+
name: this.resourceNameFormatter.format(this.props.appConfig.deploymentStrategy.name),
|
|
83
83
|
replicateTo: this.props.appConfig.deploymentStrategy.replicateTo,
|
|
84
84
|
})
|
|
85
85
|
}
|
|
@@ -187,11 +187,11 @@ export class LambdaWithIamAccess extends CommonConstruct {
|
|
|
187
187
|
*/
|
|
188
188
|
protected createIamUserForLambdaFunction() {
|
|
189
189
|
this.lambdaIamUser = new User(this, `${this.id}-lambda-user`, {
|
|
190
|
-
userName: this.resourceNameFormatter(`${this.id}-user`),
|
|
190
|
+
userName: this.resourceNameFormatter.format(`${this.id}-user`),
|
|
191
191
|
})
|
|
192
192
|
|
|
193
193
|
new Policy(this, `${this.id}-lambda-user-policy`, {
|
|
194
|
-
policyName: this.resourceNameFormatter(`${this.id}-policy`),
|
|
194
|
+
policyName: this.resourceNameFormatter.format(`${this.id}-policy`),
|
|
195
195
|
statements: [
|
|
196
196
|
new PolicyStatement({
|
|
197
197
|
actions: ['lambda:InvokeFunction'],
|
|
@@ -204,7 +204,7 @@ export class LambdaWithIamAccess extends CommonConstruct {
|
|
|
204
204
|
if (this.props.lambda.lambdaAliases && !_.isEmpty(this.props.lambda.lambdaAliases)) {
|
|
205
205
|
_.forEach(this.props.lambda.lambdaAliases, (alias, index) => {
|
|
206
206
|
new Policy(this, `${this.id}-alias-user-policy`, {
|
|
207
|
-
policyName: this.resourceNameFormatter(`${this.id}--alias-policy-${index}`),
|
|
207
|
+
policyName: this.resourceNameFormatter.format(`${this.id}--alias-policy-${index}`),
|
|
208
208
|
statements: [
|
|
209
209
|
new PolicyStatement({
|
|
210
210
|
actions: ['lambda:InvokeFunction'],
|
|
@@ -296,11 +296,11 @@ export class SiteWithEcsBackend extends CommonConstruct {
|
|
|
296
296
|
enableECSManagedTags: true,
|
|
297
297
|
healthCheckGracePeriod: Duration.seconds(60),
|
|
298
298
|
listenerPort: this.props.siteTask.listenerPort,
|
|
299
|
-
loadBalancerName: this.resourceNameFormatter(this.props.siteTask.loadBalancerName ?? this.id),
|
|
299
|
+
loadBalancerName: this.resourceNameFormatter.format(this.props.siteTask.loadBalancerName ?? this.id),
|
|
300
300
|
maxHealthyPercent: this.props.siteTask.maxHealthyPercent,
|
|
301
301
|
memoryLimitMiB: this.props.siteTask.memoryLimitMiB,
|
|
302
302
|
minHealthyPercent: this.props.siteTask.minHealthyPercent,
|
|
303
|
-
serviceName: this.resourceNameFormatter(this.props.siteTask.serviceName ?? this.id),
|
|
303
|
+
serviceName: this.resourceNameFormatter.format(this.props.siteTask.serviceName ?? this.id),
|
|
304
304
|
taskDefinition: this.props.siteTask.taskDefinition,
|
|
305
305
|
taskImageOptions: {
|
|
306
306
|
containerPort: this.props.siteTask.taskImageOptions?.containerPort,
|
|
@@ -400,7 +400,7 @@ export class SiteWithEcsBackend extends CommonConstruct {
|
|
|
400
400
|
transitEncryption: this.props.siteFileSystem.transitEncryption,
|
|
401
401
|
transitEncryptionPort: this.props.siteFileSystem.transitEncryptionPort,
|
|
402
402
|
},
|
|
403
|
-
name: this.resourceNameFormatter(this.props.siteFileSystem?.fileSystemName ?? this.id),
|
|
403
|
+
name: this.resourceNameFormatter.format(this.props.siteFileSystem?.fileSystemName ?? this.id),
|
|
404
404
|
})
|
|
405
405
|
|
|
406
406
|
if (this.props.siteTask.mountPoints && !_.isEmpty(this.props.siteTask.mountPoints)) {
|
|
@@ -408,7 +408,7 @@ export class SiteWithEcsBackend extends CommonConstruct {
|
|
|
408
408
|
this.siteEcsTaskDefinition.defaultContainer?.addMountPoints({
|
|
409
409
|
containerPath: mountPoint.containerPath,
|
|
410
410
|
readOnly: mountPoint.readOnly,
|
|
411
|
-
sourceVolume: this.resourceNameFormatter(this.props.siteFileSystem?.fileSystemName ?? this.id),
|
|
411
|
+
sourceVolume: this.resourceNameFormatter.format(this.props.siteFileSystem?.fileSystemName ?? this.id),
|
|
412
412
|
})
|
|
413
413
|
})
|
|
414
414
|
}
|
|
@@ -431,7 +431,7 @@ export class SiteWithEcsBackend extends CommonConstruct {
|
|
|
431
431
|
if (!siteCachePolicy.cachePolicyName) throw `SiteCachePolicy cachePolicyName undefined for ${id}`
|
|
432
432
|
|
|
433
433
|
return new CachePolicy(this, `${id}`, {
|
|
434
|
-
cachePolicyName: this.resourceNameFormatter(siteCachePolicy.cachePolicyName),
|
|
434
|
+
cachePolicyName: this.resourceNameFormatter.format(siteCachePolicy.cachePolicyName),
|
|
435
435
|
comment: `Policy for ${this.id}-distribution - ${this.props.stage} stage`,
|
|
436
436
|
cookieBehavior: siteCachePolicy.cookieBehavior,
|
|
437
437
|
enableAcceptEncodingBrotli: siteCachePolicy.enableAcceptEncodingBrotli,
|
|
@@ -460,7 +460,9 @@ export class SiteWithEcsBackend extends CommonConstruct {
|
|
|
460
460
|
comment: `Request Policy for ${this.id}-distribution - ${this.props.stage} stage`,
|
|
461
461
|
cookieBehavior: this.props.siteOriginRequestPolicy.cookieBehavior,
|
|
462
462
|
headerBehavior: this.props.siteOriginRequestPolicy.headerBehavior,
|
|
463
|
-
originRequestPolicyName: this.resourceNameFormatter(
|
|
463
|
+
originRequestPolicyName: this.resourceNameFormatter.format(
|
|
464
|
+
this.props.siteOriginRequestPolicy.originRequestPolicyName
|
|
465
|
+
),
|
|
464
466
|
queryStringBehavior: this.props.siteOriginRequestPolicy.queryStringBehavior,
|
|
465
467
|
})
|
|
466
468
|
|
|
@@ -477,7 +479,7 @@ export class SiteWithEcsBackend extends CommonConstruct {
|
|
|
477
479
|
return new ResponseHeadersPolicy(this, `${this.id}-${props.type}-srhp`, {
|
|
478
480
|
...props,
|
|
479
481
|
comment: `Response Header Policy for ${props.type} for ${this.id}-distribution - ${this.props.stage} stage`,
|
|
480
|
-
responseHeadersPolicyName: this.resourceNameFormatter(props.responseHeadersPolicyName),
|
|
482
|
+
responseHeadersPolicyName: this.resourceNameFormatter.format(props.responseHeadersPolicyName),
|
|
481
483
|
securityHeadersBehavior: {
|
|
482
484
|
...props.securityHeadersBehavior,
|
|
483
485
|
strictTransportSecurity: {
|
|
@@ -193,7 +193,7 @@ export class SiteWithLambdaBackend extends CommonConstruct {
|
|
|
193
193
|
if (!siteCachePolicy.cachePolicyName) throw `SiteCachePolicy cachePolicyName undefined for ${id}`
|
|
194
194
|
|
|
195
195
|
return new CachePolicy(this, `${id}`, {
|
|
196
|
-
cachePolicyName: this.resourceNameFormatter(siteCachePolicy.cachePolicyName),
|
|
196
|
+
cachePolicyName: this.resourceNameFormatter.format(siteCachePolicy.cachePolicyName),
|
|
197
197
|
comment: `Policy for ${this.id}-distribution - ${this.props.stage} stage`,
|
|
198
198
|
cookieBehavior: siteCachePolicy.cookieBehavior,
|
|
199
199
|
enableAcceptEncodingBrotli: siteCachePolicy.enableAcceptEncodingBrotli,
|
|
@@ -222,7 +222,9 @@ export class SiteWithLambdaBackend extends CommonConstruct {
|
|
|
222
222
|
comment: `Request Policy for ${this.id}-distribution - ${this.props.stage} stage`,
|
|
223
223
|
cookieBehavior: this.props.siteOriginRequestPolicy.cookieBehavior,
|
|
224
224
|
headerBehavior: this.props.siteOriginRequestPolicy.headerBehavior,
|
|
225
|
-
originRequestPolicyName: this.resourceNameFormatter(
|
|
225
|
+
originRequestPolicyName: this.resourceNameFormatter.format(
|
|
226
|
+
this.props.siteOriginRequestPolicy.originRequestPolicyName
|
|
227
|
+
),
|
|
226
228
|
queryStringBehavior: this.props.siteOriginRequestPolicy.queryStringBehavior,
|
|
227
229
|
})
|
|
228
230
|
|
|
@@ -239,7 +241,7 @@ export class SiteWithLambdaBackend extends CommonConstruct {
|
|
|
239
241
|
return new ResponseHeadersPolicy(this, `${this.id}-${props.type}-srhp`, {
|
|
240
242
|
...props,
|
|
241
243
|
comment: `Response Header Policy for ${props.type} for ${this.id}-distribution - ${this.props.stage} stage`,
|
|
242
|
-
responseHeadersPolicyName: this.resourceNameFormatter(props.responseHeadersPolicyName),
|
|
244
|
+
responseHeadersPolicyName: this.resourceNameFormatter.format(props.responseHeadersPolicyName),
|
|
243
245
|
securityHeadersBehavior: {
|
|
244
246
|
...props.securityHeadersBehavior,
|
|
245
247
|
strictTransportSecurity: {
|
|
@@ -65,7 +65,7 @@ export class ApiManager {
|
|
|
65
65
|
handler: lambdaFunction,
|
|
66
66
|
minCompressionSize: props.minCompressionSizeInBytes ? Size.bytes(props.minCompressionSizeInBytes) : undefined,
|
|
67
67
|
proxy: props.proxy ?? true,
|
|
68
|
-
restApiName: scope.resourceNameFormatter(props.restApiName, props.resourceNameOptions),
|
|
68
|
+
restApiName: scope.resourceNameFormatter.format(props.restApiName, props.resourceNameOptions),
|
|
69
69
|
})
|
|
70
70
|
|
|
71
71
|
if (props.tags && !_.isEmpty(props.tags)) {
|
|
@@ -51,7 +51,7 @@ export class AppConfigManager {
|
|
|
51
51
|
|
|
52
52
|
const application = new CfnApplication(scope, `${id}`, {
|
|
53
53
|
...props.application,
|
|
54
|
-
name: scope.resourceNameFormatter(props.application.name, props.resourceNameOptions),
|
|
54
|
+
name: scope.resourceNameFormatter.format(props.application.name, props.resourceNameOptions),
|
|
55
55
|
})
|
|
56
56
|
|
|
57
57
|
createCfnOutput(`${id}-ApplicationId`, scope, Fn.ref(application.logicalId))
|
|
@@ -109,7 +109,7 @@ export class AppConfigManager {
|
|
|
109
109
|
...props.configurationProfile,
|
|
110
110
|
applicationId,
|
|
111
111
|
locationUri: props.configurationProfile.locationUri || 'hosted',
|
|
112
|
-
name:
|
|
112
|
+
name: scope.resourceNameFormatter.format(props.configurationProfile.name, props.resourceNameOptions),
|
|
113
113
|
})
|
|
114
114
|
|
|
115
115
|
createCfnOutput(`${id}-configurationProfileId`, scope, Fn.ref(profile.logicalId))
|
|
@@ -284,7 +284,7 @@ export class CloudFrontManager {
|
|
|
284
284
|
...environment,
|
|
285
285
|
},
|
|
286
286
|
filesystem: accessPoint ? FileSystem.fromEfsAccessPoint(accessPoint, mountPath ?? '/mnt/msg') : undefined,
|
|
287
|
-
functionName: scope.resourceNameFormatter(props.functionName, props.resourceNameOptions),
|
|
287
|
+
functionName: scope.resourceNameFormatter.format(props.functionName, props.resourceNameOptions),
|
|
288
288
|
handler: props.handler ?? 'index.handler',
|
|
289
289
|
layers: layers,
|
|
290
290
|
logRetention: props.logRetention,
|
|
@@ -360,7 +360,7 @@ export class CloudFrontManager {
|
|
|
360
360
|
filePath: props.functionFilePath,
|
|
361
361
|
}),
|
|
362
362
|
comment: props.comment,
|
|
363
|
-
functionName: scope.resourceNameFormatter(props.functionName, props.resourceNameOptions),
|
|
363
|
+
functionName: scope.resourceNameFormatter.format(props.functionName, props.resourceNameOptions),
|
|
364
364
|
})
|
|
365
365
|
|
|
366
366
|
createCfnOutput(`${id}-functionArn`, scope, cloudfrontFunction.functionArn)
|
|
@@ -72,7 +72,7 @@ export class CloudTrailManager {
|
|
|
72
72
|
s3BucketName: logBucket.bucketName,
|
|
73
73
|
s3KeyPrefix: `logs-${props.trailName}`,
|
|
74
74
|
tags: [{ key: 'service', value: scope.props.name }],
|
|
75
|
-
trailName: scope.resourceNameFormatter(props.trailName, props.resourceNameOptions),
|
|
75
|
+
trailName: scope.resourceNameFormatter.format(props.trailName, props.resourceNameOptions),
|
|
76
76
|
})
|
|
77
77
|
|
|
78
78
|
cloudTrail.addDependency(logBucketPolicy)
|
|
@@ -60,7 +60,7 @@ export class DynamodbManager {
|
|
|
60
60
|
|
|
61
61
|
const table = new TableV2(scope, `${id}`, {
|
|
62
62
|
...props,
|
|
63
|
-
tableName: scope.resourceNameFormatter(props.tableName, props.resourceNameOptions),
|
|
63
|
+
tableName: scope.resourceNameFormatter.format(props.tableName, props.resourceNameOptions),
|
|
64
64
|
})
|
|
65
65
|
|
|
66
66
|
createCfnOutput(`${id}-tableName`, scope, table.tableName)
|
|
@@ -159,12 +159,12 @@ export class EcsManager {
|
|
|
159
159
|
cluster,
|
|
160
160
|
enableECSManagedTags: true,
|
|
161
161
|
healthCheckGracePeriod: props.healthCheckGracePeriod ?? Duration.seconds(60),
|
|
162
|
-
loadBalancerName: scope.resourceNameFormatter(props.loadBalancerName, props.resourceNameOptions),
|
|
162
|
+
loadBalancerName: scope.resourceNameFormatter.format(props.loadBalancerName, props.resourceNameOptions),
|
|
163
163
|
runtimePlatform: {
|
|
164
164
|
cpuArchitecture: props.runtimePlatform?.cpuArchitecture ?? CpuArchitecture.X86_64,
|
|
165
165
|
operatingSystemFamily: props.runtimePlatform?.operatingSystemFamily ?? OperatingSystemFamily.LINUX,
|
|
166
166
|
},
|
|
167
|
-
serviceName: scope.resourceNameFormatter(props.serviceName, props.resourceNameOptions),
|
|
167
|
+
serviceName: scope.resourceNameFormatter.format(props.serviceName, props.resourceNameOptions),
|
|
168
168
|
taskImageOptions: {
|
|
169
169
|
...props.taskImageOptions,
|
|
170
170
|
enableLogging: props.taskImageOptions?.enableLogging ?? true,
|
|
@@ -59,7 +59,7 @@ export class EfsManager {
|
|
|
59
59
|
const fileSystemId = props.provisionNewOnDeployment ? `${id}-${new Date().getMilliseconds()}` : `${id}`
|
|
60
60
|
const fileSystem = new FileSystem(scope, `${fileSystemId}`, {
|
|
61
61
|
...props,
|
|
62
|
-
fileSystemName: scope.resourceNameFormatter(props.fileSystemName, props.resourceNameOptions),
|
|
62
|
+
fileSystemName: scope.resourceNameFormatter.format(props.fileSystemName, props.resourceNameOptions),
|
|
63
63
|
lifecyclePolicy: props.lifecyclePolicy ?? LifecyclePolicy.AFTER_7_DAYS,
|
|
64
64
|
outOfInfrequentAccessPolicy: props.outOfInfrequentAccessPolicy ?? OutOfInfrequentAccessPolicy.AFTER_1_ACCESS,
|
|
65
65
|
performanceMode: props.performanceMode ?? PerformanceMode.GENERAL_PURPOSE,
|
|
@@ -82,7 +82,7 @@ export class EksManager {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
const cluster = new Cluster(scope, `${id}Cluster`, {
|
|
85
|
-
clusterName: scope.resourceNameFormatter(props.clusterName, props.resourceNameOptions),
|
|
85
|
+
clusterName: scope.resourceNameFormatter.format(props.clusterName, props.resourceNameOptions),
|
|
86
86
|
defaultCapacity: props.appCapacity,
|
|
87
87
|
defaultCapacityInstance: InstanceType.of(InstanceClass.T3, InstanceSize.LARGE),
|
|
88
88
|
version: KubernetesVersion.V1_27,
|
|
@@ -61,7 +61,7 @@ export class ElastiCacheManager {
|
|
|
61
61
|
const elasticacheCluster = new CfnCacheCluster(scope, `${id}`, {
|
|
62
62
|
...props,
|
|
63
63
|
cacheSubnetGroupName: subnetGroup.cacheSubnetGroupName,
|
|
64
|
-
clusterName: scope.resourceNameFormatter(props.clusterName, props.resourceNameOptions),
|
|
64
|
+
clusterName: scope.resourceNameFormatter.format(props.clusterName, props.resourceNameOptions),
|
|
65
65
|
logDeliveryConfigurations,
|
|
66
66
|
vpcSecurityGroupIds: securityGroupIds,
|
|
67
67
|
})
|