@mettlecast/domain-cdk-packer 0.2.76 → 0.2.78
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.js +25 -2
- package/dist/pack-domain.d.ts +1 -1
- package/package.json +1 -1
package/dist/DomainStack.js
CHANGED
|
@@ -82,8 +82,12 @@ export class DomainStack extends cdk.Stack {
|
|
|
82
82
|
})
|
|
83
83
|
: undefined);
|
|
84
84
|
const domainId = registry.domain.id;
|
|
85
|
-
const projectId = props.projectId ?? this.stackName.split('-')[0]
|
|
86
|
-
|
|
85
|
+
const projectId = props.projectId ?? this.stackName.split('-')[0];
|
|
86
|
+
if (!projectId)
|
|
87
|
+
throw new Error('DomainStack requires projectId — pass it via packDomain options or ensure the stack name starts with the project prefix');
|
|
88
|
+
const envCode = props.envCode ?? this.stackName.split('-')[1];
|
|
89
|
+
if (!envCode)
|
|
90
|
+
throw new Error('DomainStack requires envCode — pass it via packDomain options or ensure the stack name includes the environment code');
|
|
87
91
|
const resourceBaseName = domainResourceName(projectId, envCode, domainId);
|
|
88
92
|
const allowedOrigins = corsAllowedOrigins ?? ['*'];
|
|
89
93
|
this.httpApi = httpApi ?? new apigwv2.HttpApi(this, 'HttpApi', {
|
|
@@ -173,6 +177,9 @@ export class DomainStack extends cdk.Stack {
|
|
|
173
177
|
if (appSecretArn) {
|
|
174
178
|
environment.APP_SECRET_ARN = appSecretArn;
|
|
175
179
|
}
|
|
180
|
+
if (process.env['SES_FROM_EMAIL']) {
|
|
181
|
+
environment.SES_FROM_EMAIL = process.env['SES_FROM_EMAIL'];
|
|
182
|
+
}
|
|
176
183
|
const resolveSubnetSelection = (access) => {
|
|
177
184
|
if (access === 'internet')
|
|
178
185
|
return internetSubnetSelection ?? internalSubnetSelection;
|
|
@@ -547,6 +554,22 @@ export class DomainStack extends cdk.Stack {
|
|
|
547
554
|
}));
|
|
548
555
|
}
|
|
549
556
|
}
|
|
557
|
+
// Grant SES SendEmail permission when a verified sending address is configured.
|
|
558
|
+
// Scoped to the SES identity ARN derived from SES_FROM_EMAIL (e.g. an
|
|
559
|
+
// address or domain identity) — least-privilege. Falls back to 'arn:aws:ses:*:*:*'
|
|
560
|
+
// only when the address is not address-shaped (tests/local).
|
|
561
|
+
if (process.env['SES_FROM_EMAIL']) {
|
|
562
|
+
const sesFrom = process.env['SES_FROM_EMAIL'];
|
|
563
|
+
const sesIdentity = sesFrom.includes('@')
|
|
564
|
+
? `arn:aws:ses:${this.region}:${this.account}:identity/${sesFrom}`
|
|
565
|
+
: `arn:aws:ses:${this.region}:${this.account}:identity/${sesFrom}`;
|
|
566
|
+
for (const fn of allDomainLambdas) {
|
|
567
|
+
fn.addToRolePolicy(new iam.PolicyStatement({
|
|
568
|
+
actions: ['ses:SendEmail', 'ses:SendRawEmail'],
|
|
569
|
+
resources: [sesIdentity],
|
|
570
|
+
}));
|
|
571
|
+
}
|
|
572
|
+
}
|
|
550
573
|
// Replace the tenant-scoped role trust policy — only domain Lambdas can assume with tenantId tag
|
|
551
574
|
// Use a single Statement with ArnLike wildcard to stay under the 2048-byte ACL size limit
|
|
552
575
|
const cfnRole = tenantScopedRole.node.defaultChild;
|
package/dist/pack-domain.d.ts
CHANGED
|
@@ -63,4 +63,4 @@ export interface PackDomainOptions {
|
|
|
63
63
|
* @param options - Optional configuration including VPC, auth, and DB settings.
|
|
64
64
|
* @returns The constructed DomainStack.
|
|
65
65
|
*/
|
|
66
|
-
export declare function packDomain(registry: DomainRegistry, app: cdk.App, stackId: string, eventBusArn: string, options?: PackDomainOptions
|
|
66
|
+
export declare function packDomain(registry: DomainRegistry, app: cdk.App, stackId: string, eventBusArn: string, options?: PackDomainOptions): DomainStack;
|