@mettlecast/domain-cdk-packer 0.2.72 → 0.2.74
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/DomainStack.d.ts +2 -0
- package/dist/DomainStack.js +13 -1
- package/dist/pack-domain.d.ts +2 -0
- package/dist/pack-domain.js +3 -1
- package/package.json +1 -1
package/dist/DomainStack.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ export interface DomainStackProps extends cdk.StackProps {
|
|
|
17
17
|
databaseUrl?: string;
|
|
18
18
|
/** ARN of the RDS secret for DB credentials — added to Lambda env as DB_SECRET_ARN. */
|
|
19
19
|
dbSecretArn?: string;
|
|
20
|
+
/** ARN of the shared AppSecret in Secrets Manager — injected as APP_SECRET_ARN env var. */
|
|
21
|
+
appSecretArn?: string;
|
|
20
22
|
/** Cognito User Pool ARN — when provided, HTTP API routes are JWT-protected. */
|
|
21
23
|
userPoolArn?: string;
|
|
22
24
|
/** Cognito User Pool ID — preferred over parsing userPoolArn for JWT authorizer issuer. */
|
package/dist/DomainStack.js
CHANGED
|
@@ -64,7 +64,7 @@ export class DomainStack extends cdk.Stack {
|
|
|
64
64
|
*/
|
|
65
65
|
constructor(scope, id, props) {
|
|
66
66
|
super(scope, id, props);
|
|
67
|
-
const { registry, eventBusArn, eventBusName, databaseUrl, dbSecretArn, userPoolArn, userPoolId, userPoolClientId, internalSubnetSelection, internetSubnetSelection, enableCmk, enableWaf, enableAlarms, alarmSnsTopicArn, enableCanaryDeploy, reservedConcurrency, logRetentionDays, corsAllowedOrigins, allowCredentials, disableCloudWatchDashboards } = props;
|
|
67
|
+
const { registry, eventBusArn, eventBusName, databaseUrl, dbSecretArn, appSecretArn, userPoolArn, userPoolId, userPoolClientId, internalSubnetSelection, internetSubnetSelection, enableCmk, enableWaf, enableAlarms, alarmSnsTopicArn, enableCanaryDeploy, reservedConcurrency, logRetentionDays, corsAllowedOrigins, allowCredentials, disableCloudWatchDashboards } = props;
|
|
68
68
|
const vpc = props.vpc ?? (props.vpcId
|
|
69
69
|
? ec2.Vpc.fromVpcAttributes(this, 'SharedVpc', {
|
|
70
70
|
vpcId: props.vpcId,
|
|
@@ -170,6 +170,9 @@ export class DomainStack extends cdk.Stack {
|
|
|
170
170
|
if (userPoolId) {
|
|
171
171
|
environment.COGNITO_USER_POOL_ID = userPoolId;
|
|
172
172
|
}
|
|
173
|
+
if (appSecretArn) {
|
|
174
|
+
environment.APP_SECRET_ARN = appSecretArn;
|
|
175
|
+
}
|
|
173
176
|
const resolveSubnetSelection = (access) => {
|
|
174
177
|
if (access === 'internet')
|
|
175
178
|
return internetSubnetSelection ?? internalSubnetSelection;
|
|
@@ -535,6 +538,15 @@ export class DomainStack extends cdk.Stack {
|
|
|
535
538
|
}));
|
|
536
539
|
}
|
|
537
540
|
}
|
|
541
|
+
// Grant read access to the shared AppSecret for ctx.secrets population.
|
|
542
|
+
if (appSecretArn) {
|
|
543
|
+
for (const fn of allDomainLambdas) {
|
|
544
|
+
fn.addToRolePolicy(new iam.PolicyStatement({
|
|
545
|
+
actions: ['secretsmanager:GetSecretValue'],
|
|
546
|
+
resources: [appSecretArn],
|
|
547
|
+
}));
|
|
548
|
+
}
|
|
549
|
+
}
|
|
538
550
|
// Replace the tenant-scoped role trust policy — only domain Lambdas can assume with tenantId tag
|
|
539
551
|
// Use a single Statement with ArnLike wildcard to stay under the 2048-byte ACL size limit
|
|
540
552
|
const cfnRole = tenantScopedRole.node.defaultChild;
|
package/dist/pack-domain.d.ts
CHANGED
|
@@ -41,6 +41,8 @@ export interface PackDomainOptions {
|
|
|
41
41
|
databaseUrl?: string;
|
|
42
42
|
/** ARN of the RDS secret for DB credentials. */
|
|
43
43
|
dbSecretArn?: string;
|
|
44
|
+
/** ARN of the shared AppSecret in Secrets Manager — injected as APP_SECRET_ARN env var. */
|
|
45
|
+
appSecretArn?: string | undefined;
|
|
44
46
|
/** EventBridge bus name; avoids ARN parsing when ARN is a dynamic reference. */
|
|
45
47
|
eventBusName?: string;
|
|
46
48
|
/** Project id used to prefix per-domain physical resource names (e.g. `mtc-dev-data-management`). */
|
package/dist/pack-domain.js
CHANGED
|
@@ -20,7 +20,8 @@ export function packDomain(registry, app, stackId, eventBusArn, options) {
|
|
|
20
20
|
'userPoolId' in options ||
|
|
21
21
|
'userPoolClientId' in options ||
|
|
22
22
|
'databaseUrl' in options ||
|
|
23
|
-
'dbSecretArn' in options
|
|
23
|
+
'dbSecretArn' in options ||
|
|
24
|
+
'appSecretArn' in options)
|
|
24
25
|
? { env: options }
|
|
25
26
|
: options || {};
|
|
26
27
|
return new DomainStack(app, stackId, {
|
|
@@ -43,6 +44,7 @@ export function packDomain(registry, app, stackId, eventBusArn, options) {
|
|
|
43
44
|
userPoolClientId: opts.userPoolClientId,
|
|
44
45
|
databaseUrl: opts.databaseUrl,
|
|
45
46
|
dbSecretArn: opts.dbSecretArn,
|
|
47
|
+
appSecretArn: opts.appSecretArn,
|
|
46
48
|
eventBusName: opts.eventBusName,
|
|
47
49
|
projectId: opts.projectId,
|
|
48
50
|
envCode: opts.envCode,
|