Skip to content

Commit 6315de3

Browse files
committed
chore: wip
1 parent 8ac6f9e commit 6315de3

File tree

2 files changed

+23
-26
lines changed

2 files changed

+23
-26
lines changed

.stacks/core/cloud/src/cloud.ts

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -805,26 +805,26 @@ export class StacksCloud extends Stack {
805805
}),
806806
)
807807

808-
// this.storage.emailBucket.addToResourcePolicy(
809-
// new iam.PolicyStatement({
810-
// sid: `AllowSESToEncryptMessagesBelongingToThisAccount`,
811-
// effect: iam.Effect.ALLOW,
812-
// principals: [sesPrincipal],
813-
// actions: [
814-
// 'kms:Decrypt',
815-
// 'kms:GenerateDataKey*',
816-
// ],
817-
// resources: ['*'],
818-
// conditions: {
819-
// StringEquals: {
820-
// 'aws:SourceAccount': Stack.of(this).account,
821-
// },
822-
// ArnLike: {
823-
// 'aws:SourceArn': `arn:aws:ses:${this.region}:${Stack.of(this).account}:receipt-rule-set/${ruleSetName}:receipt-rule/${ruleName}`,
824-
// },
825-
// },
826-
// }),
827-
// )
808+
this.storage.emailBucket.addToResourcePolicy(
809+
new iam.PolicyStatement({
810+
sid: `AllowSESToEncryptMessagesBelongingToThisAccount`,
811+
effect: iam.Effect.ALLOW,
812+
principals: [sesPrincipal],
813+
actions: [
814+
'kms:Decrypt',
815+
'kms:GenerateDataKey*',
816+
],
817+
resources: ['*'],
818+
conditions: {
819+
StringEquals: {
820+
'aws:SourceAccount': Stack.of(this).account,
821+
},
822+
ArnLike: {
823+
'aws:SourceArn': `arn:aws:ses:${this.region}:${Stack.of(this).account}:receipt-rule-set/${ruleSetName}:receipt-rule/${ruleName}`,
824+
},
825+
},
826+
}),
827+
)
828828

829829
const iamGroup = new iam.Group(this, 'IAMGroup', {
830830
groupName: `${this.appName}-${appEnv}-email-management-s3-group`,
@@ -1039,7 +1039,7 @@ export class StacksCloud extends Stack {
10391039
actions: ['s3:*'],
10401040
resources: [
10411041
`arn:aws:s3:::${this.storage.emailBucket.bucketName}`,
1042-
`arn:aws:s3:::${this.storage.emailBucket.bucketName}/`,
1042+
`arn:aws:s3:::${this.storage.emailBucket.bucketName}/*`,
10431043
],
10441044
})
10451045

@@ -1053,15 +1053,10 @@ export class StacksCloud extends Stack {
10531053

10541054
this.storage.emailBucket.addToResourcePolicy(new iam.PolicyStatement({
10551055
sid: `AllowSESToInvokeLambda`,
1056-
effect: iam.Effect.ALLOW,
10571056
principals: [sesPrincipal],
10581057
actions: [
10591058
'lambda:InvokeFunction',
10601059
],
1061-
resources: [
1062-
`arn:aws:lambda:${this.region}:${Stack.of(this).account}:function:${lambdaEmailInbound.functionName}`,
1063-
`arn:aws:lambda:${this.region}:${Stack.of(this).account}:function:${lambdaEmailConverter.functionName}`,
1064-
],
10651060
conditions: {
10661061
StringEquals: {
10671062
'aws:SourceAccount': Stack.of(this).account,
@@ -1075,6 +1070,8 @@ export class StacksCloud extends Stack {
10751070
this.storage.emailBucket.addEventNotification(s3.EventType.OBJECT_CREATED_PUT, new s3n.LambdaDestination(lambdaEmailInbound), { prefix: 'tmp/email_in' })
10761071
this.storage.emailBucket.addEventNotification(s3.EventType.OBJECT_CREATED_PUT, new s3n.LambdaDestination(lambdaEmailOutbound), { prefix: 'tmp/email_out/json' })
10771072
this.storage.emailBucket.addEventNotification(s3.EventType.OBJECT_CREATED_COPY, new s3n.LambdaDestination(lambdaEmailConverter), { prefix: 'sent/' })
1073+
this.storage.emailBucket.addEventNotification(s3.EventType.OBJECT_CREATED_COPY, new s3n.LambdaDestination(lambdaEmailConverter), { prefix: 'inbox/' })
1074+
this.storage.emailBucket.addEventNotification(s3.EventType.OBJECT_CREATED_COPY, new s3n.LambdaDestination(lambdaEmailConverter), { prefix: 'today/' })
10781075
}
10791076

10801077
additionalBehaviors(): Record<string, cloudfront.BehaviorOptions> {

bun.lockb

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)