@gradientedge/cdk-utils 8.69.0 → 8.71.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/construct/site-with-ecs-backend/main.js +4 -3
- package/dist/src/lib/manager/aws/secrets-manager.d.ts +8 -0
- package/dist/src/lib/manager/aws/secrets-manager.js +16 -0
- package/package.json +1 -1
- package/src/lib/construct/site-with-ecs-backend/main.ts +4 -3
- package/src/lib/manager/aws/secrets-manager.ts +19 -0
|
@@ -146,9 +146,10 @@ class SiteWithEcsBackend extends common_1.CommonConstruct {
|
|
|
146
146
|
*/
|
|
147
147
|
resolveSiteDomainNames() {
|
|
148
148
|
/* the internal domain name used by ELB */
|
|
149
|
-
this.siteInternalDomainName =
|
|
150
|
-
|
|
151
|
-
|
|
149
|
+
this.siteInternalDomainName =
|
|
150
|
+
this.isProductionStage() || this.props.skipStageForARecords
|
|
151
|
+
? `${this.props.siteSubDomain}-internal.${this.fullyQualifiedDomainName}`
|
|
152
|
+
: `${this.props.siteSubDomain}-internal-${this.props.stage}.${this.fullyQualifiedDomainName}`;
|
|
152
153
|
/* the external domain name exposed to CloudFront */
|
|
153
154
|
this.siteExternalDomainName =
|
|
154
155
|
this.isProductionStage() || this.props.skipStageForARecords
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SecretsManager as SM } from '@aws-sdk/client-secrets-manager';
|
|
2
2
|
import * as cdk from 'aws-cdk-lib';
|
|
3
|
+
import * as secretsManager from 'aws-cdk-lib/aws-secretsmanager';
|
|
3
4
|
import * as common from '../../common';
|
|
4
5
|
/**
|
|
5
6
|
* @stability experimental
|
|
@@ -50,4 +51,11 @@ export declare class SecretsManager {
|
|
|
50
51
|
* @param exportName
|
|
51
52
|
*/
|
|
52
53
|
retrieveSecretFromSecretsManager(id: string, scope: common.CommonConstruct, stackName: string, exportName: string): cdk.aws_secretsmanager.ISecret;
|
|
54
|
+
/**
|
|
55
|
+
* @summary Method to create a secret
|
|
56
|
+
* @param {string} id scoped id of the resource
|
|
57
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
58
|
+
* @param {secretsManager.SecretProps} props the secret properties
|
|
59
|
+
*/
|
|
60
|
+
createSecret(id: string, scope: common.CommonConstruct, props: secretsManager.SecretProps): cdk.aws_secretsmanager.Secret;
|
|
53
61
|
}
|
|
@@ -27,6 +27,7 @@ exports.SecretsManager = void 0;
|
|
|
27
27
|
const client_secrets_manager_1 = require("@aws-sdk/client-secrets-manager");
|
|
28
28
|
const cdk = __importStar(require("aws-cdk-lib"));
|
|
29
29
|
const secretsManager = __importStar(require("aws-cdk-lib/aws-secretsmanager"));
|
|
30
|
+
const utils = __importStar(require("../../utils"));
|
|
30
31
|
/**
|
|
31
32
|
* @stability experimental
|
|
32
33
|
* @category cdk-utils.secrets-manager
|
|
@@ -90,5 +91,20 @@ class SecretsManager {
|
|
|
90
91
|
retrieveSecretFromSecretsManager(id, scope, stackName, exportName) {
|
|
91
92
|
return secretsManager.Secret.fromSecretNameV2(scope, `${id}`, cdk.Fn.importValue(`${stackName}-${scope.props.stage}-${exportName}`));
|
|
92
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* @summary Method to create a secret
|
|
96
|
+
* @param {string} id scoped id of the resource
|
|
97
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
98
|
+
* @param {secretsManager.SecretProps} props the secret properties
|
|
99
|
+
*/
|
|
100
|
+
createSecret(id, scope, props) {
|
|
101
|
+
const secret = new secretsManager.Secret(scope, `${id}`, {
|
|
102
|
+
...props,
|
|
103
|
+
secretName: `${props.secretName}-${scope.props.stage}`,
|
|
104
|
+
});
|
|
105
|
+
utils.createCfnOutput(`${id}-secretName`, scope, secret.secretName);
|
|
106
|
+
utils.createCfnOutput(`${id}-secretArn`, scope, secret.secretArn);
|
|
107
|
+
return secret;
|
|
108
|
+
}
|
|
93
109
|
}
|
|
94
110
|
exports.SecretsManager = SecretsManager;
|
package/package.json
CHANGED
|
@@ -159,9 +159,10 @@ export class SiteWithEcsBackend extends CommonConstruct {
|
|
|
159
159
|
*/
|
|
160
160
|
protected resolveSiteDomainNames() {
|
|
161
161
|
/* the internal domain name used by ELB */
|
|
162
|
-
this.siteInternalDomainName =
|
|
163
|
-
|
|
164
|
-
|
|
162
|
+
this.siteInternalDomainName =
|
|
163
|
+
this.isProductionStage() || this.props.skipStageForARecords
|
|
164
|
+
? `${this.props.siteSubDomain}-internal.${this.fullyQualifiedDomainName}`
|
|
165
|
+
: `${this.props.siteSubDomain}-internal-${this.props.stage}.${this.fullyQualifiedDomainName}`
|
|
165
166
|
|
|
166
167
|
/* the external domain name exposed to CloudFront */
|
|
167
168
|
this.siteExternalDomainName =
|
|
@@ -2,6 +2,7 @@ import { SecretsManager as SM } from '@aws-sdk/client-secrets-manager'
|
|
|
2
2
|
import * as cdk from 'aws-cdk-lib'
|
|
3
3
|
import * as secretsManager from 'aws-cdk-lib/aws-secretsmanager'
|
|
4
4
|
import * as common from '../../common'
|
|
5
|
+
import * as utils from '../../utils'
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* @stability experimental
|
|
@@ -80,4 +81,22 @@ export class SecretsManager {
|
|
|
80
81
|
cdk.Fn.importValue(`${stackName}-${scope.props.stage}-${exportName}`)
|
|
81
82
|
)
|
|
82
83
|
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @summary Method to create a secret
|
|
87
|
+
* @param {string} id scoped id of the resource
|
|
88
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
89
|
+
* @param {secretsManager.SecretProps} props the secret properties
|
|
90
|
+
*/
|
|
91
|
+
public createSecret(id: string, scope: common.CommonConstruct, props: secretsManager.SecretProps) {
|
|
92
|
+
const secret = new secretsManager.Secret(scope, `${id}`, {
|
|
93
|
+
...props,
|
|
94
|
+
secretName: `${props.secretName}-${scope.props.stage}`,
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
utils.createCfnOutput(`${id}-secretName`, scope, secret.secretName)
|
|
98
|
+
utils.createCfnOutput(`${id}-secretArn`, scope, secret.secretArn)
|
|
99
|
+
|
|
100
|
+
return secret
|
|
101
|
+
}
|
|
83
102
|
}
|