@gradientedge/cdk-utils 8.94.0 → 8.96.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.
@@ -71,7 +71,7 @@ class RestApiLambdaWithCache extends __1.RestApiLambda {
71
71
  */
72
72
  resolveVpc() {
73
73
  if (this.props.useExistingVpc) {
74
- this.restApivpc = this.vpcManager.retrieveCommonVpc(`${this.id}`, this, this.props.vpcName);
74
+ this.restApivpc = this.vpcManager.retrieveCommonVpc(`${this.id}-vpc`, this, this.props.vpcName);
75
75
  }
76
76
  else {
77
77
  this.restApivpc = this.vpcManager.createCommonVpc(this, this.props.restApiVpc, this.props.restApiVpc.vpcName);
@@ -82,7 +82,7 @@ class RestApiLambdaWithCache extends __1.RestApiLambda {
82
82
  */
83
83
  resolveSecurityGroup() {
84
84
  if (this.props.securityGroupExportName) {
85
- this.restApiSecurityGroup = ec2.SecurityGroup.fromSecurityGroupId(this, `${this.id}`, cdk.Fn.importValue(this.props.securityGroupExportName));
85
+ this.restApiSecurityGroup = ec2.SecurityGroup.fromSecurityGroupId(this, `${this.id}-security-group`, cdk.Fn.importValue(this.props.securityGroupExportName));
86
86
  }
87
87
  else {
88
88
  this.restApiSecurityGroup = new ec2.SecurityGroup(this, `${this.id}-security-group-${this.props.stage}`, {
@@ -71,6 +71,8 @@ export declare class SiteWithEcsBackend extends CommonConstruct {
71
71
  * @summary Method to resolve a certificate based on attributes
72
72
  */
73
73
  protected resolveCertificate(): void;
74
+ protected resolveGlobalCertificate(): void;
75
+ protected resolveRegionalCertificate(): void;
74
76
  /**
75
77
  * @summary Method to resolve secrets from SecretsManager
76
78
  * - To be implemented in the overriding method in the implementation class
@@ -117,13 +117,23 @@ class SiteWithEcsBackend extends common_1.CommonConstruct {
117
117
  * @summary Method to resolve a certificate based on attributes
118
118
  */
119
119
  resolveCertificate() {
120
- /* determine site certificate */
120
+ this.resolveGlobalCertificate();
121
+ this.resolveRegionalCertificate();
122
+ }
123
+ resolveGlobalCertificate() {
121
124
  if (this.props.siteCertificate.useExistingCertificate &&
122
125
  this.props.siteCertificate.certificateSsmName &&
123
126
  this.props.siteCertificate.certificateRegion) {
124
127
  this.props.siteCertificate.certificateArn = this.ssmManager.readStringParameterFromRegion(`${this.id}-certificate-parameter`, this, this.props.siteCertificate.certificateSsmName, this.props.siteCertificate.certificateRegion);
125
128
  }
126
129
  this.siteCertificate = this.acmManager.resolveCertificate(`${this.id}-certificate`, this, this.props.siteCertificate);
130
+ }
131
+ resolveRegionalCertificate() {
132
+ if (this.props.siteRegionalCertificate.useExistingCertificate &&
133
+ this.props.siteRegionalCertificate.certificateSsmName &&
134
+ this.props.siteRegionalCertificate.certificateRegion) {
135
+ this.props.siteRegionalCertificate.certificateArn = this.ssmManager.readStringParameterFromRegion(`${this.id}-regional-certificate-parameter`, this, this.props.siteRegionalCertificate.certificateSsmName, this.props.siteRegionalCertificate.certificateRegion);
136
+ }
127
137
  this.siteRegionalCertificate = this.acmManager.resolveCertificate(`${this.id}-regional-certificate`, this, this.props.siteRegionalCertificate, this.siteHostedZone);
128
138
  }
129
139
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradientedge/cdk-utils",
3
- "version": "8.94.0",
3
+ "version": "8.96.0",
4
4
  "description": "Utilities for AWS CDK provisioning",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -54,7 +54,7 @@ export abstract class RestApiLambdaWithCache extends RestApiLambda {
54
54
  */
55
55
  protected resolveVpc() {
56
56
  if (this.props.useExistingVpc) {
57
- this.restApivpc = this.vpcManager.retrieveCommonVpc(`${this.id}`, this, this.props.vpcName)
57
+ this.restApivpc = this.vpcManager.retrieveCommonVpc(`${this.id}-vpc`, this, this.props.vpcName)
58
58
  } else {
59
59
  this.restApivpc = this.vpcManager.createCommonVpc(this, this.props.restApiVpc, this.props.restApiVpc.vpcName)
60
60
  }
@@ -67,7 +67,7 @@ export abstract class RestApiLambdaWithCache extends RestApiLambda {
67
67
  if (this.props.securityGroupExportName) {
68
68
  this.restApiSecurityGroup = ec2.SecurityGroup.fromSecurityGroupId(
69
69
  this,
70
- `${this.id}`,
70
+ `${this.id}-security-group`,
71
71
  cdk.Fn.importValue(this.props.securityGroupExportName)
72
72
  )
73
73
  } else {
@@ -111,7 +111,11 @@ export class SiteWithEcsBackend extends CommonConstruct {
111
111
  * @summary Method to resolve a certificate based on attributes
112
112
  */
113
113
  protected resolveCertificate() {
114
- /* determine site certificate */
114
+ this.resolveGlobalCertificate()
115
+ this.resolveRegionalCertificate()
116
+ }
117
+
118
+ protected resolveGlobalCertificate() {
115
119
  if (
116
120
  this.props.siteCertificate.useExistingCertificate &&
117
121
  this.props.siteCertificate.certificateSsmName &&
@@ -129,7 +133,21 @@ export class SiteWithEcsBackend extends CommonConstruct {
129
133
  this,
130
134
  this.props.siteCertificate
131
135
  )
136
+ }
132
137
 
138
+ protected resolveRegionalCertificate() {
139
+ if (
140
+ this.props.siteRegionalCertificate.useExistingCertificate &&
141
+ this.props.siteRegionalCertificate.certificateSsmName &&
142
+ this.props.siteRegionalCertificate.certificateRegion
143
+ ) {
144
+ this.props.siteRegionalCertificate.certificateArn = this.ssmManager.readStringParameterFromRegion(
145
+ `${this.id}-regional-certificate-parameter`,
146
+ this,
147
+ this.props.siteRegionalCertificate.certificateSsmName,
148
+ this.props.siteRegionalCertificate.certificateRegion
149
+ )
150
+ }
133
151
  this.siteRegionalCertificate = this.acmManager.resolveCertificate(
134
152
  `${this.id}-regional-certificate`,
135
153
  this,