Skip to content

Commit ac22cbc

Browse files
committed
chore: wip
1 parent 9546b0d commit ac22cbc

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

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

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,18 @@ export class StacksCloud extends Stack {
539539
},
540540
})
541541

542-
this.storage.emailBucket?.addToResourcePolicy(bucketPolicyStatement)
542+
this.storage.emailBucket.addToResourcePolicy(bucketPolicyStatement)
543+
// Grant SES permission to write to the S3 bucket
544+
this.storage.emailBucket.addToResourcePolicy(new iam.PolicyStatement({
545+
principals: [sesPrincipal],
546+
actions: ['s3:PutObject'],
547+
resources: [this.storage.emailBucket.arnForObjects('*')],
548+
conditions: {
549+
StringEquals: {
550+
'aws:Referer': this.account,
551+
},
552+
},
553+
}))
543554

544555
const iamGroup = new iam.Group(this, 'IAMGroup', {
545556
groupName: `${this.appName}-${appEnv}-email-management-s3-group`,
@@ -784,18 +795,6 @@ export class StacksCloud extends Stack {
784795

785796
lambdaEmailConverterRole.addToPolicy(converterS3PolicyStatement)
786797

787-
// Grant SES permission to write to the S3 bucket
788-
this.storage.emailBucket.addToResourcePolicy(new iam.PolicyStatement({
789-
principals: [new iam.ServicePrincipal('ses.amazonaws.com')],
790-
actions: ['s3:PutObject'],
791-
resources: [this.storage.emailBucket.arnForObjects('*')],
792-
conditions: {
793-
StringEquals: {
794-
'aws:Referer': this.account,
795-
},
796-
},
797-
}))
798-
799798
this.storage.emailBucket.addEventNotification(s3.EventType.OBJECT_CREATED_PUT, new s3n.LambdaDestination(lambdaEmailInbound), { prefix: 'tmp/email_in' })
800799
this.storage.emailBucket.addEventNotification(s3.EventType.OBJECT_CREATED_PUT, new s3n.LambdaDestination(lambdaEmailOutbound), { prefix: 'tmp/email_out/json' })
801800
this.storage.emailBucket.addEventNotification(s3.EventType.OBJECT_CREATED_COPY, new s3n.LambdaDestination(lambdaEmailConverter), { prefix: 'sent/' })

0 commit comments

Comments
 (0)