Skip to content

Commit e1578aa

Browse files
committed
chore: wip
1 parent 50c2036 commit e1578aa

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

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

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,8 @@ export class StacksCloud extends Stack {
523523
this.storage.emailBucket = this.createBucket('email')
524524

525525
const sesPrincipal = new iam.ServicePrincipal('ses.amazonaws.com')
526-
const bucketPolicyStatement = new iam.PolicyStatement({
526+
527+
this.storage.emailBucket.addToResourcePolicy(new iam.PolicyStatement({
527528
sid: 'AllowSESPuts',
528529
effect: iam.Effect.ALLOW,
529530
principals: [sesPrincipal],
@@ -537,9 +538,19 @@ export class StacksCloud extends Stack {
537538
'aws:Referer': this.account,
538539
},
539540
},
540-
})
541+
}))
541542

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`,
@@ -657,6 +668,7 @@ export class StacksCloud extends Stack {
657668
{
658669
s3Action: {
659670
bucketName: this.storage.emailBucket.bucketName,
671+
// kmsKeyArn: this.storage.emailBucket.encryptionKey?.keyArn,
660672
objectKeyPrefix: 'tmp/email_in',
661673
},
662674
},

0 commit comments

Comments
 (0)