@gradientedge/cdk-utils 9.12.0 → 9.14.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.
Files changed (114) hide show
  1. package/dist/src/lib/aws/common/resource-name-formatter.js +2 -0
  2. package/dist/src/lib/aws/common/stack.d.ts +3 -0
  3. package/dist/src/lib/aws/common/stack.js +3 -0
  4. package/dist/src/lib/aws/common/types.d.ts +7 -0
  5. package/dist/src/lib/aws/construct/api-to-any-target/main.js +2 -2
  6. package/dist/src/lib/aws/construct/api-to-eventbridge-target/main.js +3 -3
  7. package/dist/src/lib/aws/construct/api-to-eventbridge-target-with-sns/main.js +4 -4
  8. package/dist/src/lib/aws/construct/api-to-lambda-target/main.js +1 -1
  9. package/dist/src/lib/aws/construct/rest-api-lambda-with-cache/main.js +1 -1
  10. package/dist/src/lib/aws/construct/site-with-ecs-backend/main.js +2 -2
  11. package/dist/src/lib/aws/services/api-gateway/main.js +1 -1
  12. package/dist/src/lib/aws/services/api-gateway/types.d.ts +0 -3
  13. package/dist/src/lib/aws/services/appconfig/main.js +2 -2
  14. package/dist/src/lib/aws/services/appconfig/types.d.ts +0 -2
  15. package/dist/src/lib/aws/services/cloudfront/main.js +2 -2
  16. package/dist/src/lib/aws/services/cloudfront/types.d.ts +0 -2
  17. package/dist/src/lib/aws/services/cloudtrail/main.js +1 -1
  18. package/dist/src/lib/aws/services/cloudtrail/types.d.ts +0 -2
  19. package/dist/src/lib/aws/services/cloudwatch/logs.js +6 -2
  20. package/dist/src/lib/aws/services/cloudwatch/main.js +3 -0
  21. package/dist/src/lib/aws/services/codebuild/main.js +1 -1
  22. package/dist/src/lib/aws/services/dynamodb/main.js +9 -2
  23. package/dist/src/lib/aws/services/dynamodb/types.d.ts +1 -2
  24. package/dist/src/lib/aws/services/elastic-container-service/main.js +2 -2
  25. package/dist/src/lib/aws/services/elastic-container-service/types.d.ts +0 -2
  26. package/dist/src/lib/aws/services/elastic-file-system/main.js +1 -1
  27. package/dist/src/lib/aws/services/elastic-file-system/types.d.ts +0 -2
  28. package/dist/src/lib/aws/services/elastic-kubernetes-service/main.js +1 -1
  29. package/dist/src/lib/aws/services/elastic-kubernetes-service/types.d.ts +0 -2
  30. package/dist/src/lib/aws/services/elasticache/main.js +1 -1
  31. package/dist/src/lib/aws/services/elasticache/types.d.ts +0 -2
  32. package/dist/src/lib/aws/services/eventbridge/main.js +9 -9
  33. package/dist/src/lib/aws/services/eventbridge/types.d.ts +0 -7
  34. package/dist/src/lib/aws/services/evidently/main.js +4 -4
  35. package/dist/src/lib/aws/services/evidently/types.d.ts +0 -5
  36. package/dist/src/lib/aws/services/identity-access-management/main.d.ts +20 -20
  37. package/dist/src/lib/aws/services/identity-access-management/main.js +71 -70
  38. package/dist/src/lib/aws/services/key-management-service/main.js +3 -1
  39. package/dist/src/lib/aws/services/lambda/main.js +7 -8
  40. package/dist/src/lib/aws/services/lambda/types.d.ts +0 -3
  41. package/dist/src/lib/aws/services/secrets-manager/main.js +1 -1
  42. package/dist/src/lib/aws/services/secrets-manager/types.d.ts +0 -2
  43. package/dist/src/lib/aws/services/simple-notification-service/main.js +4 -4
  44. package/dist/src/lib/aws/services/simple-notification-service/types.d.ts +0 -2
  45. package/dist/src/lib/aws/services/simple-queue-service/main.js +1 -1
  46. package/dist/src/lib/aws/services/simple-queue-service/types.d.ts +0 -2
  47. package/dist/src/lib/aws/services/simple-storage-service/main.js +2 -3
  48. package/dist/src/lib/aws/services/simple-storage-service/types.d.ts +0 -2
  49. package/dist/src/lib/aws/services/step-function/main.js +1 -1
  50. package/dist/src/lib/aws/services/step-function/types.d.ts +0 -2
  51. package/dist/src/lib/aws/services/systems-manager/main.d.ts +3 -3
  52. package/dist/src/lib/aws/services/systems-manager/main.js +3 -1
  53. package/dist/src/lib/aws/services/systems-manager/types.d.ts +3 -0
  54. package/dist/src/lib/aws/services/virtual-private-cloud/main.d.ts +2 -1
  55. package/dist/src/lib/aws/services/virtual-private-cloud/main.js +9 -6
  56. package/dist/src/lib/aws/services/virtual-private-cloud/types.d.ts +0 -2
  57. package/dist/src/lib/aws/services/web-application-firewall/main.js +2 -2
  58. package/dist/src/lib/aws/services/web-application-firewall/types.d.ts +0 -3
  59. package/package.json +6 -6
  60. package/src/lib/aws/common/resource-name-formatter.ts +2 -0
  61. package/src/lib/aws/common/stack.ts +3 -0
  62. package/src/lib/aws/common/types.ts +5 -0
  63. package/src/lib/aws/construct/api-to-any-target/main.ts +2 -2
  64. package/src/lib/aws/construct/api-to-eventbridge-target/main.ts +3 -3
  65. package/src/lib/aws/construct/api-to-eventbridge-target-with-sns/main.ts +4 -4
  66. package/src/lib/aws/construct/api-to-lambda-target/main.ts +1 -1
  67. package/src/lib/aws/construct/rest-api-lambda-with-cache/main.ts +6 -1
  68. package/src/lib/aws/construct/site-with-ecs-backend/main.ts +7 -2
  69. package/src/lib/aws/services/api-gateway/main.ts +1 -1
  70. package/src/lib/aws/services/api-gateway/types.ts +1 -4
  71. package/src/lib/aws/services/appconfig/main.ts +5 -2
  72. package/src/lib/aws/services/appconfig/types.ts +0 -1
  73. package/src/lib/aws/services/cloudfront/main.ts +2 -2
  74. package/src/lib/aws/services/cloudfront/types.ts +0 -1
  75. package/src/lib/aws/services/cloudtrail/main.ts +1 -1
  76. package/src/lib/aws/services/cloudtrail/types.ts +1 -3
  77. package/src/lib/aws/services/cloudwatch/logs.ts +4 -2
  78. package/src/lib/aws/services/cloudwatch/main.ts +5 -0
  79. package/src/lib/aws/services/codebuild/main.ts +1 -1
  80. package/src/lib/aws/services/dynamodb/main.ts +9 -2
  81. package/src/lib/aws/services/dynamodb/types.ts +1 -1
  82. package/src/lib/aws/services/elastic-container-service/main.ts +5 -2
  83. package/src/lib/aws/services/elastic-container-service/types.ts +0 -1
  84. package/src/lib/aws/services/elastic-file-system/main.ts +1 -1
  85. package/src/lib/aws/services/elastic-file-system/types.ts +0 -1
  86. package/src/lib/aws/services/elastic-kubernetes-service/main.ts +1 -1
  87. package/src/lib/aws/services/elastic-kubernetes-service/types.ts +0 -1
  88. package/src/lib/aws/services/elasticache/main.ts +1 -1
  89. package/src/lib/aws/services/elasticache/types.ts +1 -3
  90. package/src/lib/aws/services/eventbridge/main.ts +12 -9
  91. package/src/lib/aws/services/eventbridge/types.ts +1 -8
  92. package/src/lib/aws/services/evidently/main.ts +4 -4
  93. package/src/lib/aws/services/evidently/types.ts +4 -12
  94. package/src/lib/aws/services/identity-access-management/main.ts +80 -79
  95. package/src/lib/aws/services/key-management-service/main.ts +2 -1
  96. package/src/lib/aws/services/key-management-service/types.ts +1 -0
  97. package/src/lib/aws/services/lambda/main.ts +13 -7
  98. package/src/lib/aws/services/lambda/types.ts +0 -2
  99. package/src/lib/aws/services/secrets-manager/main.ts +1 -1
  100. package/src/lib/aws/services/secrets-manager/types.ts +1 -3
  101. package/src/lib/aws/services/simple-notification-service/main.ts +4 -4
  102. package/src/lib/aws/services/simple-notification-service/types.ts +1 -3
  103. package/src/lib/aws/services/simple-queue-service/main.ts +1 -1
  104. package/src/lib/aws/services/simple-queue-service/types.ts +0 -1
  105. package/src/lib/aws/services/simple-storage-service/main.ts +6 -3
  106. package/src/lib/aws/services/simple-storage-service/types.ts +0 -1
  107. package/src/lib/aws/services/step-function/main.ts +4 -1
  108. package/src/lib/aws/services/step-function/types.ts +1 -3
  109. package/src/lib/aws/services/systems-manager/main.ts +5 -4
  110. package/src/lib/aws/services/systems-manager/types.ts +5 -0
  111. package/src/lib/aws/services/virtual-private-cloud/main.ts +12 -6
  112. package/src/lib/aws/services/virtual-private-cloud/types.ts +0 -1
  113. package/src/lib/aws/services/web-application-firewall/main.ts +2 -2
  114. package/src/lib/aws/services/web-application-firewall/types.ts +2 -6
@@ -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.format(props.name, props.resourceNameOptions),
37
+ name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.waf),
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.format(props.name, props.resourceNameOptions),
57
+ name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.waf),
58
58
  tags: [{ key: 'service', value: scope.props.name }],
59
59
  });
60
60
  (0, utils_1.createCfnOutput)(`${id}-webAclId`, scope, webAcl.attrId);
@@ -1,12 +1,9 @@
1
1
  import { CfnIPSetProps, CfnWebACLProps } from 'aws-cdk-lib/aws-wafv2';
2
- import { ResourceNameFormatterProps } from '../../common';
3
2
  /**
4
3
  */
5
4
  export interface WafIPSetProps extends CfnIPSetProps {
6
- resourceNameOptions?: ResourceNameFormatterProps;
7
5
  }
8
6
  /**
9
7
  */
10
8
  export interface WafWebACLProps extends CfnWebACLProps {
11
- resourceNameOptions?: ResourceNameFormatterProps;
12
9
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradientedge/cdk-utils",
3
- "version": "9.12.0",
3
+ "version": "9.14.0",
4
4
  "description": "Utilities for AWS CDK provisioning",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -53,16 +53,16 @@
53
53
  "@aws-sdk/client-secrets-manager": "^3.637.0",
54
54
  "@aws-sdk/credential-providers": "^3.637.0",
55
55
  "@aws-sdk/types": "^3.609.0",
56
- "@cdktf/provider-aws": "^19.32.0",
56
+ "@cdktf/provider-aws": "^19.33.0",
57
57
  "@cdktf/provider-azurerm": "^13.0.0",
58
58
  "@cdktf/provider-cloudflare": "^11.18.0",
59
59
  "@types/lodash": "^4.17.7",
60
- "@types/node": "^22.5.0",
60
+ "@types/node": "^22.5.1",
61
61
  "@types/uuid": "^10.0.0",
62
62
  "app-root-path": "^3.1.0",
63
- "aws-cdk-lib": "^2.154.1",
63
+ "aws-cdk-lib": "^2.155.0",
64
64
  "cdktf": "^0.20.8",
65
- "cdktf-local-exec": "^0.5.34",
65
+ "cdktf-local-exec": "^0.5.35",
66
66
  "constructs": "^10.3.0",
67
67
  "lodash": "^4.17.21",
68
68
  "moment": "^2.30.1",
@@ -78,7 +78,7 @@
78
78
  "@types/jest": "^29.5.12",
79
79
  "@typescript-eslint/eslint-plugin": "^8.3.0",
80
80
  "@typescript-eslint/parser": "^8.3.0",
81
- "aws-cdk": "^2.154.1",
81
+ "aws-cdk": "^2.155.0",
82
82
  "better-docs": "^2.7.3",
83
83
  "codecov": "^3.8.3",
84
84
  "commitizen": "^4.3.0",
@@ -17,9 +17,11 @@ export class ResourceNameFormatter extends Construct {
17
17
  */
18
18
  public format(resourceName: string, options?: ResourceNameFormatterProps) {
19
19
  const resourceNameElements = []
20
+ resourceNameElements.push(options?.globalPrefix ? this.props.globalPrefix : undefined)
20
21
  resourceNameElements.push(options?.prefix ?? this.props.resourcePrefix)
21
22
  resourceNameElements.push(resourceName)
22
23
  resourceNameElements.push(options?.suffix ?? this.props.resourceSuffix)
24
+ resourceNameElements.push(options?.globalSuffix ? this.props.globalSuffix : undefined)
23
25
  resourceNameElements.push(this.props.stage)
24
26
  return resourceNameElements.filter(resourceNameElement => resourceNameElement != undefined).join('-')
25
27
  }
@@ -58,6 +58,9 @@ export class CommonStack extends Stack {
58
58
  name: props.stackName || 'cdk-utils',
59
59
  nodejsRuntime: this.node.tryGetContext('nodejsRuntime') ?? CommonStack.NODEJS_RUNTIME,
60
60
  region: this.node.tryGetContext('region'),
61
+ globalPrefix: this.node.tryGetContext('globalPrefix'),
62
+ globalSuffix: this.node.tryGetContext('globalSuffix'),
63
+ resourceNameOptions: this.node.tryGetContext('resourceNameOptions'),
61
64
  resourcePrefix: this.node.tryGetContext('resourcePrefix'),
62
65
  resourceSuffix: this.node.tryGetContext('resourceSuffix'),
63
66
  skipStageForARecords: this.node.tryGetContext('skipStageForARecords'),
@@ -8,6 +8,8 @@ import { BaseProps } from '../../common'
8
8
  export interface CommonStackProps extends BaseProps, StackProps {
9
9
  region: string
10
10
  resourceProjectIdentifier?: string
11
+ globalPrefix?: string
12
+ globalSuffix?: string
11
13
  resourcePrefix?: string
12
14
  resourceSuffix?: string
13
15
  logRetention?: RetentionDays
@@ -16,9 +18,12 @@ export interface CommonStackProps extends BaseProps, StackProps {
16
18
  excludeDomainNameForBuckets?: boolean
17
19
  excludeAccountNumberForBuckets?: boolean
18
20
  nodejsRuntime?: Runtime
21
+ resourceNameOptions?: { [key: string]: ResourceNameFormatterProps }
19
22
  }
20
23
 
21
24
  export interface ResourceNameFormatterProps {
25
+ globalPrefix?: boolean
26
+ globalSuffix?: boolean
22
27
  prefix?: string
23
28
  suffix?: string
24
29
  }
@@ -111,7 +111,7 @@ export class ApiToAnyTarget extends CommonConstruct {
111
111
 
112
112
  protected createApiToAnyTargetRestApiLogGroup() {
113
113
  this.apiToAnyTargetRestApi.accessLogGroup = this.logManager.createLogGroup(`${this.id}-rest-api-access-log`, this, {
114
- logGroupName: `/custom/api/${this.id}-rest-api-access`,
114
+ logGroupName: `${this.id}-access`,
115
115
  removalPolicy: RemovalPolicy.DESTROY,
116
116
  })
117
117
  }
@@ -156,7 +156,7 @@ export class ApiToAnyTarget extends CommonConstruct {
156
156
  ...this.props.api.restApi,
157
157
  restApiName: this.resourceNameFormatter.format(
158
158
  this.props.api.restApi?.restApiName,
159
- this.props.api.restApi?.resourceNameOptions
159
+ this.props.resourceNameOptions?.apigateway
160
160
  ),
161
161
  })
162
162
  this.addCfnOutput(`${this.id}-restApiId`, this.apiToAnyTargetRestApi.api.restApiId)
@@ -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.resourceNameFormatter.format(this.id)}/events/api-to-eventbridge-target`,
178
+ logGroupName: `${this.id}-api-to-event-bridge-target`,
179
179
  },
180
180
  ...this.props.event.logGroup,
181
181
  })
@@ -356,7 +356,7 @@ export class ApiToEventBridgeTarget extends CommonConstruct {
356
356
  `${this.id}-rest-api-access-log`,
357
357
  this,
358
358
  {
359
- logGroupName: `/custom/api/${this.resourceNameFormatter.format(this.id)}-rest-api-access`,
359
+ logGroupName: `${this.id}-access`,
360
360
  removalPolicy: RemovalPolicy.DESTROY,
361
361
  }
362
362
  )
@@ -408,7 +408,7 @@ export class ApiToEventBridgeTarget extends CommonConstruct {
408
408
  ...this.props.api.restApi,
409
409
  restApiName: this.resourceNameFormatter.format(
410
410
  this.props.api.restApi?.restApiName,
411
- this.props.api.restApi?.resourceNameOptions
411
+ this.props.resourceNameOptions?.apigateway
412
412
  ),
413
413
  })
414
414
 
@@ -274,7 +274,7 @@ export class ApiToEventBridgeTargetWithSns extends CommonConstruct {
274
274
  protected createApiDestinationLogGroupSuccess() {
275
275
  if (this.props.api.useExisting) return
276
276
  this.apiEvent.logGroupSuccess = this.logManager.createLogGroup(`${this.id}-destination-success-log`, this, {
277
- logGroupName: `/${this.id}/events/api-destination-success`,
277
+ logGroupName: `${this.id}-destination`,
278
278
  ...this.props.event.logGroupSuccess,
279
279
  })
280
280
  }
@@ -314,7 +314,7 @@ export class ApiToEventBridgeTargetWithSns extends CommonConstruct {
314
314
  protected createApiDestinationLogGroupFailure() {
315
315
  if (this.props.api.useExisting) return
316
316
  this.apiEvent.logGroupFailure = this.logManager.createLogGroup(`${this.id}-destination-failure-log`, this, {
317
- logGroupName: `/${this.id}/events/api-destination-failure`,
317
+ logGroupName: `${this.id}-destination-failure`,
318
318
  ...this.props.event.logGroupFailure,
319
319
  })
320
320
  }
@@ -509,7 +509,7 @@ export class ApiToEventBridgeTargetWithSns extends CommonConstruct {
509
509
  }
510
510
 
511
511
  const accessLogGroup = this.logManager.createLogGroup(`${this.id}-sns-rest-api-access-log`, this, {
512
- logGroupName: `/custom/api/${this.id}-destined-rest-api-access`,
512
+ logGroupName: `${this.id}-access`,
513
513
  removalPolicy: RemovalPolicy.DESTROY,
514
514
  })
515
515
 
@@ -540,7 +540,7 @@ export class ApiToEventBridgeTargetWithSns extends CommonConstruct {
540
540
  ...this.props.api,
541
541
  restApiName: this.resourceNameFormatter.format(
542
542
  this.props.api.restApi?.restApiName,
543
- this.props.api.restApi?.resourceNameOptions
543
+ this.props.resourceNameOptions?.apigateway
544
544
  ),
545
545
  })
546
546
  this.addCfnOutput(`${this.id}-restApiId`, this.apiDestinedRestApi.api.restApiId)
@@ -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.resourceNameFormatter.format(this.id)}-rest-api-access`,
159
+ logGroupName: `${this.id}-access`,
160
160
  removalPolicy: RemovalPolicy.DESTROY,
161
161
  })
162
162
 
@@ -57,7 +57,12 @@ export abstract class RestApiLambdaWithCache extends RestApiLambda {
57
57
  if (this.props.useExistingVpc) {
58
58
  this.restApivpc = this.vpcManager.retrieveCommonVpc(`${this.id}-vpc`, this, this.props.vpcName)
59
59
  } else {
60
- this.restApivpc = this.vpcManager.createCommonVpc(this, this.props.restApiVpc, this.props.restApiVpc.vpcName)
60
+ this.restApivpc = this.vpcManager.createCommonVpc(
61
+ `${this.id}-vpc`,
62
+ this,
63
+ this.props.restApiVpc,
64
+ this.props.restApiVpc.vpcName
65
+ )
61
66
  }
62
67
  }
63
68
 
@@ -213,9 +213,14 @@ export class SiteWithEcsBackend extends CommonConstruct {
213
213
  */
214
214
  protected createVpc() {
215
215
  if (this.props.useExistingVpc) {
216
- this.siteVpc = this.vpcManager.retrieveCommonVpc(`${this.id}`, this, this.props.siteVpc.vpcName)
216
+ this.siteVpc = this.vpcManager.retrieveCommonVpc(`${this.id}-vpc`, this, this.props.siteVpc.vpcName)
217
217
  } else {
218
- this.siteVpc = this.vpcManager.createCommonVpc(this, this.props.siteVpc, this.props.siteVpc.vpcName)
218
+ this.siteVpc = this.vpcManager.createCommonVpc(
219
+ `${this.id}-vpc`,
220
+ this,
221
+ this.props.siteVpc,
222
+ this.props.siteVpc.vpcName
223
+ )
219
224
  }
220
225
  }
221
226
 
@@ -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.format(props.restApiName, props.resourceNameOptions),
68
+ restApiName: scope.resourceNameFormatter.format(props.restApiName, scope.props.resourceNameOptions?.apigateway),
69
69
  })
70
70
 
71
71
  if (props.tags && !_.isEmpty(props.tags)) {
@@ -7,9 +7,6 @@ import { TagProps } from '../../types'
7
7
  export interface LambdaRestApiProps extends LambdaRestApigProps {
8
8
  tags?: TagProps[]
9
9
  minCompressionSizeInBytes?: number
10
- resourceNameOptions?: ResourceNameFormatterProps
11
10
  }
12
11
 
13
- export interface RestApigProps extends RestApiProps {
14
- resourceNameOptions?: ResourceNameFormatterProps
15
- }
12
+ export interface RestApigProps extends RestApiProps {}
@@ -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.format(props.application.name, props.resourceNameOptions),
54
+ name: scope.resourceNameFormatter.format(props.application.name, scope.props.resourceNameOptions?.appconfig),
55
55
  })
56
56
 
57
57
  createCfnOutput(`${id}-ApplicationId`, scope, Fn.ref(application.logicalId))
@@ -109,7 +109,10 @@ export class AppConfigManager {
109
109
  ...props.configurationProfile,
110
110
  applicationId,
111
111
  locationUri: props.configurationProfile.locationUri || 'hosted',
112
- name: scope.resourceNameFormatter.format(props.configurationProfile.name, props.resourceNameOptions),
112
+ name: scope.resourceNameFormatter.format(
113
+ props.configurationProfile.name,
114
+ scope.props.resourceNameOptions?.appconfig
115
+ ),
113
116
  })
114
117
 
115
118
  createCfnOutput(`${id}-configurationProfileId`, scope, Fn.ref(profile.logicalId))
@@ -16,5 +16,4 @@ export interface AppConfigProps {
16
16
  deploymentStrategy: CfnDeploymentStrategyProps
17
17
  environment: CfnEnvironmentProps
18
18
  id: string
19
- resourceNameOptions?: ResourceNameFormatterProps
20
19
  }
@@ -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.format(props.functionName, props.resourceNameOptions),
287
+ functionName: scope.resourceNameFormatter.format(props.functionName, scope.props.resourceNameOptions?.cloudfront),
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.format(props.functionName, props.resourceNameOptions),
363
+ functionName: scope.resourceNameFormatter.format(props.functionName, scope.props.resourceNameOptions?.cloudfront),
364
364
  })
365
365
 
366
366
  createCfnOutput(`${id}-functionArn`, scope, cloudfrontFunction.functionArn)
@@ -23,5 +23,4 @@ export interface DistributionProps extends CfDistributionProps {
23
23
  export interface CloudfrontFunctionProps extends FunctionProps {
24
24
  eventType: string
25
25
  functionFilePath: string
26
- resourceNameOptions?: ResourceNameFormatterProps
27
26
  }
@@ -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.format(props.trailName, props.resourceNameOptions),
75
+ trailName: scope.resourceNameFormatter.format(props.trailName, scope.props.resourceNameOptions?.cloudtrail),
76
76
  })
77
77
 
78
78
  cloudTrail.addDependency(logBucketPolicy)
@@ -3,6 +3,4 @@ import { ResourceNameFormatterProps } from '../../common'
3
3
 
4
4
  /**
5
5
  */
6
- export interface CloudTrailProps extends CfnTrailProps {
7
- resourceNameOptions?: ResourceNameFormatterProps
8
- }
6
+ export interface CloudTrailProps extends CfnTrailProps {}
@@ -60,10 +60,11 @@ export class LogManager {
60
60
  */
61
61
  public createCfnLogGroup(id: string, scope: CommonConstruct, props: LogProps) {
62
62
  if (!props) throw `Logs props undefined for ${id}`
63
+ if (!props.logGroupName) throw `Logs logGroupName undefined for ${id}`
63
64
 
64
65
  const logGroup = new logs.CfnLogGroup(scope, `${id}`, {
65
66
  ...props,
66
- logGroupName: `${props.logGroupName}-${scope.props.stage}`,
67
+ logGroupName: `/${scope.resourceNameFormatter.format(props.logGroupName, scope.props.resourceNameOptions?.logs)}`,
67
68
  retentionInDays: props.retention,
68
69
  })
69
70
 
@@ -86,10 +87,11 @@ export class LogManager {
86
87
  */
87
88
  public createLogGroup(id: string, scope: CommonConstruct, props: LogProps) {
88
89
  if (!props) throw `Logs props undefined for ${id}`
90
+ if (!props.logGroupName) throw `Logs logGroupName undefined for ${id}`
89
91
 
90
92
  const logGroup = new logs.LogGroup(scope, `${id}`, {
91
93
  ...props,
92
- logGroupName: `${props.logGroupName}-${scope.props.stage}`,
94
+ logGroupName: `/${scope.resourceNameFormatter.format(props.logGroupName, scope.props.resourceNameOptions?.logs)}`,
93
95
  removalPolicy: props.removalPolicy ?? cdk.RemovalPolicy.DESTROY,
94
96
  retention: props.retention,
95
97
  })
@@ -107,9 +107,14 @@ export class CloudWatchManager {
107
107
  */
108
108
  public createDashboard(id: string, scope: CommonConstruct, props: DashboardProps, widgets?: watch.IWidget[][]) {
109
109
  if (!props) throw `Dashboard props undefined for ${id}`
110
+ if (!props.dashboardName) throw `Dashboard dashboardName undefined for ${id}`
110
111
 
111
112
  const dashboard = new watch.Dashboard(scope, `${id}`, {
112
113
  ...props,
114
+ dashboardName: scope.resourceNameFormatter.format(
115
+ props.dashboardName,
116
+ scope.props.resourceNameOptions?.cloudwatch
117
+ ),
113
118
  end: CloudWatchManager.determineTimeRange(props.end),
114
119
  start: CloudWatchManager.determineTimeRange(props.start),
115
120
  widgets,
@@ -71,7 +71,7 @@ export class CodeBuildManager {
71
71
  }),
72
72
  },
73
73
  },
74
- role: scope.iamManager.roleForCloudfrontInvalidation(id, scope),
74
+ role: scope.iamManager.createRoleForCloudfrontInvalidation(id, scope),
75
75
  timeout: Duration.minutes(5),
76
76
  })
77
77
  }
@@ -30,10 +30,11 @@ export class DynamodbManager {
30
30
  */
31
31
  public createTable(id: string, scope: CommonConstruct, props: TableProps) {
32
32
  if (!props) throw `Table props undefined for ${id}`
33
+ if (!props.tableName) throw `Table tableName undefined for ${id}`
33
34
 
34
35
  const table = new Table(scope, `${id}`, {
35
36
  ...props,
36
- tableName: `${props.tableName}-${scope.props.stage}`,
37
+ tableName: scope.resourceNameFormatter.format(props.tableName, scope.props.resourceNameOptions?.table),
37
38
  })
38
39
 
39
40
  if (props.tags && !_.isEmpty(props.tags)) {
@@ -60,9 +61,15 @@ export class DynamodbManager {
60
61
 
61
62
  const table = new TableV2(scope, `${id}`, {
62
63
  ...props,
63
- tableName: scope.resourceNameFormatter.format(props.tableName, props.resourceNameOptions),
64
+ tableName: scope.resourceNameFormatter.format(props.tableName, scope.props.resourceNameOptions?.table),
64
65
  })
65
66
 
67
+ if (props.tags && !_.isEmpty(props.tags)) {
68
+ _.forEach(props.tags, tag => {
69
+ Tags.of(table).add(tag.key, tag.value)
70
+ })
71
+ }
72
+
66
73
  createCfnOutput(`${id}-tableName`, scope, table.tableName)
67
74
  createCfnOutput(`${id}-tableArn`, scope, table.tableArn)
68
75
 
@@ -9,5 +9,5 @@ export interface TableProps extends dynamodb.TableProps {
9
9
  }
10
10
 
11
11
  export interface TablePropsV2 extends dynamodb.TablePropsV2 {
12
- resourceNameOptions?: ResourceNameFormatterProps
12
+ tags?: TagProps[]
13
13
  }
@@ -159,12 +159,15 @@ export class EcsManager {
159
159
  cluster,
160
160
  enableECSManagedTags: true,
161
161
  healthCheckGracePeriod: props.healthCheckGracePeriod ?? Duration.seconds(60),
162
- loadBalancerName: scope.resourceNameFormatter.format(props.loadBalancerName, props.resourceNameOptions),
162
+ loadBalancerName: scope.resourceNameFormatter.format(
163
+ props.loadBalancerName,
164
+ scope.props.resourceNameOptions?.ecs
165
+ ),
163
166
  runtimePlatform: {
164
167
  cpuArchitecture: props.runtimePlatform?.cpuArchitecture ?? CpuArchitecture.X86_64,
165
168
  operatingSystemFamily: props.runtimePlatform?.operatingSystemFamily ?? OperatingSystemFamily.LINUX,
166
169
  },
167
- serviceName: scope.resourceNameFormatter.format(props.serviceName, props.resourceNameOptions),
170
+ serviceName: scope.resourceNameFormatter.format(props.serviceName, scope.props.resourceNameOptions?.ecs),
168
171
  taskImageOptions: {
169
172
  ...props.taskImageOptions,
170
173
  enableLogging: props.taskImageOptions?.enableLogging ?? true,
@@ -55,5 +55,4 @@ export interface EcsApplicationLoadBalancedFargateServiceProps extends Applicati
55
55
  logging?: AwsLogDriverProps
56
56
  mountPoints?: MountPoint[]
57
57
  siteScaling?: EcsScalingProps
58
- resourceNameOptions?: ResourceNameFormatterProps
59
58
  }
@@ -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.format(props.fileSystemName, props.resourceNameOptions),
62
+ fileSystemName: scope.resourceNameFormatter.format(props.fileSystemName, scope.props.resourceNameOptions?.efs),
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,
@@ -10,7 +10,6 @@ export interface EfsFileSystemProps extends FileSystemProps {
10
10
  rootDirectory?: string
11
11
  transitEncryption?: string
12
12
  transitEncryptionPort?: number
13
- resourceNameOptions?: ResourceNameFormatterProps
14
13
  }
15
14
 
16
15
  /**
@@ -82,7 +82,7 @@ export class EksManager {
82
82
  }
83
83
 
84
84
  const cluster = new Cluster(scope, `${id}Cluster`, {
85
- clusterName: scope.resourceNameFormatter.format(props.clusterName, props.resourceNameOptions),
85
+ clusterName: scope.resourceNameFormatter.format(props.clusterName, scope.props.resourceNameOptions?.eks),
86
86
  defaultCapacity: props.appCapacity,
87
87
  defaultCapacityInstance: InstanceType.of(InstanceClass.T3, InstanceSize.LARGE),
88
88
  version: KubernetesVersion.V1_27,
@@ -6,5 +6,4 @@ import { ResourceNameFormatterProps } from '../../common'
6
6
  export interface EksClusterProps extends ClusterProps {
7
7
  appCapacity: number
8
8
  appContainerPort: number
9
- resourceNameOptions?: ResourceNameFormatterProps
10
9
  }
@@ -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.format(props.clusterName, props.resourceNameOptions),
64
+ clusterName: scope.resourceNameFormatter.format(props.clusterName, scope.props.resourceNameOptions?.elasticache),
65
65
  logDeliveryConfigurations,
66
66
  vpcSecurityGroupIds: securityGroupIds,
67
67
  })
@@ -3,9 +3,7 @@ import { ResourceNameFormatterProps } from '../../common'
3
3
 
4
4
  /**
5
5
  */
6
- export interface ElastiCacheProps extends CfnCacheClusterProps {
7
- resourceNameOptions?: ResourceNameFormatterProps
8
- }
6
+ export interface ElastiCacheProps extends CfnCacheClusterProps {}
9
7
 
10
8
  /**
11
9
  */
@@ -47,7 +47,10 @@ export class EventManager {
47
47
 
48
48
  let eventBusName = props.eventBusName
49
49
  if (eventBusName && eventBusName != 'default') {
50
- eventBusName = scope.resourceNameFormatter.format(props.eventBusName, props.resourceNameOptions)
50
+ eventBusName = scope.resourceNameFormatter.format(
51
+ props.eventBusName,
52
+ scope.props.resourceNameOptions?.eventbridgeBus
53
+ )
51
54
  }
52
55
  const eventBus = new EventBus(scope, `${id}`, {
53
56
  ...props,
@@ -81,7 +84,7 @@ export class EventManager {
81
84
  const rule = new Rule(scope, `${id}`, {
82
85
  ...props,
83
86
  eventBus,
84
- ruleName: scope.resourceNameFormatter.format(props.ruleName, props.resourceNameOptions),
87
+ ruleName: scope.resourceNameFormatter.format(props.ruleName, scope.props.resourceNameOptions?.eventbridgeRule),
85
88
  })
86
89
 
87
90
  if (targets && !_.isEmpty(targets)) {
@@ -129,12 +132,12 @@ export class EventManager {
129
132
  description: 'Rule to send notification to lambda function target',
130
133
  eventBusName,
131
134
  eventPattern,
132
- name: scope.resourceNameFormatter.format(props.name, props.resourceNameOptions),
135
+ name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.eventbridgeRule),
133
136
  scheduleExpression,
134
137
  targets: [
135
138
  {
136
139
  arn: lambdaFunction.functionArn,
137
- id: scope.resourceNameFormatter.format(props.name, props.resourceNameOptions),
140
+ id: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.eventbridgeRule),
138
141
  input: props.input ?? undefined,
139
142
  },
140
143
  ],
@@ -187,7 +190,7 @@ export class EventManager {
187
190
  ...props,
188
191
  description: 'Rule to send notification on new objects in data bucket to ecs task target',
189
192
  eventPattern,
190
- name: scope.resourceNameFormatter.format(props.name, props.resourceNameOptions),
193
+ name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.eventbridgeRule),
191
194
  targets: [
192
195
  {
193
196
  arn: cluster.clusterArn,
@@ -199,7 +202,7 @@ export class EventManager {
199
202
  taskCount: 1,
200
203
  taskDefinitionArn: task.taskDefinitionArn,
201
204
  },
202
- id: scope.resourceNameFormatter.format(props.name, props.resourceNameOptions),
205
+ id: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.eventbridgeRule),
203
206
  roleArn: role instanceof Role ? role.roleArn : role.attrArn,
204
207
  },
205
208
  ],
@@ -238,7 +241,7 @@ export class EventManager {
238
241
 
239
242
  const pipe = new CfnPipe(scope, `${id}`, {
240
243
  ...props,
241
- name: scope.resourceNameFormatter.format(props.name, props.resourceNameOptions),
244
+ name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.eventbridgePipe),
242
245
  roleArn: pipeRole.roleArn,
243
246
  source: sourceQueue.queueArn,
244
247
  sourceParameters: {
@@ -298,7 +301,7 @@ export class EventManager {
298
301
 
299
302
  const pipe = new CfnPipe(scope, `${id}`, {
300
303
  ...props,
301
- name: scope.resourceNameFormatter.format(props.name, props.resourceNameOptions),
304
+ name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.eventbridgePipe),
302
305
  roleArn: pipeRole.roleArn,
303
306
  source: sourceQueue.queueArn,
304
307
  sourceParameters: {
@@ -355,7 +358,7 @@ export class EventManager {
355
358
 
356
359
  const pipe = new CfnPipe(scope, `${id}`, {
357
360
  ...props,
358
- name: scope.resourceNameFormatter.format(props.name, props.resourceNameOptions),
361
+ name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.eventbridgePipe),
359
362
  roleArn: pipeRole.roleArn,
360
363
  source: sourceDynamoDbStreamArn,
361
364
  sourceParameters: {
@@ -11,7 +11,6 @@ export interface SqsToSfnPipeProps extends CfnPipeProps {
11
11
  sfnInvocationType?: string
12
12
  sqsBatchSize?: number
13
13
  sqsMaximumBatchingWindowInSeconds?: number
14
- resourceNameOptions?: ResourceNameFormatterProps
15
14
  }
16
15
 
17
16
  /**
@@ -21,13 +20,11 @@ export interface SqsToLambdaPipeProps extends CfnPipeProps {
21
20
  sqsBatchSize?: number
22
21
  lambdaInputTemplate?: string
23
22
  sqsMaximumBatchingWindowInSeconds?: number
24
- resourceNameOptions?: ResourceNameFormatterProps
25
23
  }
26
24
 
27
25
  /**
28
26
  */
29
27
  export interface EventRuleProps extends EBRuleProps {
30
- resourceNameOptions?: ResourceNameFormatterProps
31
28
  tags?: TagProps[]
32
29
  }
33
30
 
@@ -35,15 +32,12 @@ export interface EventRuleProps extends EBRuleProps {
35
32
  */
36
33
  export interface RuleProps extends CfnRuleProps {
37
34
  input?: string
38
- resourceNameOptions?: ResourceNameFormatterProps
39
35
  tags?: TagProps[]
40
36
  }
41
37
 
42
38
  /**
43
39
  */
44
- export interface EventBusProps extends EBProps {
45
- resourceNameOptions?: ResourceNameFormatterProps
46
- }
40
+ export interface EventBusProps extends EBProps {}
47
41
 
48
42
  /**
49
43
  }
@@ -52,5 +46,4 @@ export interface DynamoDbToLambdaPipeProps extends CfnPipeProps {
52
46
  pipeFilterPattern?: any
53
47
  dynamoDbBatchSize?: number
54
48
  dynamoDbStartingPosition: string
55
- resourceNameOptions?: ResourceNameFormatterProps
56
49
  }