Skip to content

Commit

Permalink
Merge pull request #66 from Opetushallitus/feat/enable-ses-in-prod
Browse files Browse the repository at this point in the history
Add AWS SES to prod
  • Loading branch information
MikkoKauhanen authored Jan 22, 2025
2 parents abd17a7 + a848d41 commit 36d5fd6
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions aoe-infra/bin/infra.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,21 +97,10 @@ if (environmentName === 'dev' || environmentName === 'qa' || environmentName ===
vpc: Network.vpc
})

let sesIamPolicy: iam.PolicyStatement | undefined;

if (environmentName !== 'prod') {
const sesStack = new SesStack(app, 'SesStack', {
env: { region: 'eu-west-1' },
hostedZone: HostedZones.publicHostedZone
});

sesIamPolicy = new iam.PolicyStatement({
actions: ['ses:SendEmail'],
resources: [
sesStack.emailIdentity.emailIdentityArn
]
});
}
const SES = new SesStack(app, 'SesStack', {
env: {region: 'eu-west-1'},
hostedZone: HostedZones.publicHostedZone
});

const SecurityGroups = new SecurityGroupStack(app, 'SecurityGroupStack', {
env: { region: 'eu-west-1' },
Expand Down Expand Up @@ -444,6 +433,13 @@ if (environmentName === 'dev' || environmentName === 'qa' || environmentName ===
resources: [efs.fileSystem.fileSystemArn]
})

const sesIamPolicy = new iam.PolicyStatement({
actions: [ 'ses:SendEmail' ],
resources: [
SES.emailIdentity.emailIdentityArn
]
});

new EcsServiceStack(app, 'WebBackendEcsService', {
env: { region: 'eu-west-1' },
stackName: `${environmentName}-web-backend-service`,
Expand Down Expand Up @@ -496,7 +492,7 @@ if (environmentName === 'dev' || environmentName === 'qa' || environmentName ===
efsPolicyStatement,
kafkaClusterIamPolicy,
kafkaTopicIamPolicy,
...(sesIamPolicy ? [sesIamPolicy] : []),
sesIamPolicy,
],
privateDnsNamespace: namespace.privateDnsNamespace,
efs: {
Expand Down

0 comments on commit 36d5fd6

Please sign in to comment.