forked from technomancy-dev/00
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sst.config.ts
57 lines (52 loc) · 1.63 KB
/
sst.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/// <reference path="./.sst/platform/config.d.ts" />
export default $config({
app(input) {
return {
name: "double-zero",
removal: input?.stage === "production" ? "retain" : "remove",
home: "aws",
};
},
async run() {
if (!process.env.EMAIL_IDENTITY) {
const message = "Need to set EMAIL_IDENTITY env variable.";
console.error(message);
throw Error(message);
}
const topic = new sst.aws.SnsTopic("ZeroEmailSNS");
const queue = new sst.aws.Queue("ZeroEmailSQS");
topic.subscribeQueue(queue.arn);
const configSet = new aws.sesv2.ConfigurationSet("ZeroEmailConfigSet", {
configurationSetName: "zero_email_events",
});
const exampleConfigurationSetEventDestination =
new aws.sesv2.ConfigurationSetEventDestination("ZeroEmailEvent", {
configurationSetName: configSet.configurationSetName,
eventDestinationName: "zero_email_sns",
eventDestination: {
snsDestination: {
topicArn: topic.arn,
},
enabled: true,
matchingEventTypes: [
"SEND",
"REJECT",
"BOUNCE",
"COMPLAINT",
"DELIVERY",
// TODO: Handle all these.
// "OPEN",
// "CLICK",
// "RENDERING_FAILURE",
// "DELIVERY_DELAY",
// "SUBSCRIPTION",
],
},
});
const exampleEmailIdentity = new aws.sesv2.EmailIdentity("ZeroEmail", {
emailIdentity: process.env.EMAIL_IDENTITY || "",
configurationSetName: configSet.configurationSetName,
});
return { queue: queue.url };
},
});