@@ -23,6 +23,8 @@ import {
23
23
ApplicationSQSQueue ,
24
24
ApplicationSqsSnsTopicSubscription ,
25
25
PocketVPC ,
26
+ ApplicationDynamoDBTable ,
27
+ ApplicationDynamoDBTableCapacityMode ,
26
28
} from '@pocket-tools/terraform-modules' ;
27
29
28
30
import { App , S3Backend , TerraformStack , Token } from 'cdktf' ;
@@ -67,6 +69,46 @@ class AccountDataDeleter extends TerraformStack {
67
69
} ,
68
70
) ;
69
71
72
+ const exportStateDb = new ApplicationDynamoDBTable (
73
+ this ,
74
+ 'export-request-state' ,
75
+ {
76
+ tags : config . tags ,
77
+ prefix : `${ config . shortName } -${ config . environment } -Export-Request-State` ,
78
+ capacityMode : ApplicationDynamoDBTableCapacityMode . ON_DEMAND ,
79
+ preventDestroyTable : true ,
80
+ tableConfig : {
81
+ pointInTimeRecovery : {
82
+ enabled : true ,
83
+ } ,
84
+ ttl : {
85
+ enabled : true ,
86
+ attributeName : 'expiresAt' ,
87
+ } ,
88
+ hashKey : 'requestId' ,
89
+ attribute : [
90
+ {
91
+ name : 'requestId' ,
92
+ type : 'S' ,
93
+ } ,
94
+ ] ,
95
+ } ,
96
+ } ,
97
+ ) ;
98
+
99
+ const exportRequestQueue = new ApplicationSQSQueue (
100
+ this ,
101
+ 'export-request-consumer-queue' ,
102
+ {
103
+ name : config . envVars . exportRequestQueueName ,
104
+ tags : config . tags ,
105
+ visibilityTimeoutSeconds : 1800 ,
106
+ messageRetentionSeconds : 1209600 , //14 days
107
+ //need to set maxReceiveCount to enable DLQ
108
+ maxReceiveCount : 3 ,
109
+ } ,
110
+ ) ;
111
+
70
112
const listExportQueue = new ApplicationSQSQueue (
71
113
this ,
72
114
'list-export-consumer-queue' ,
@@ -80,13 +122,26 @@ class AccountDataDeleter extends TerraformStack {
80
122
} ,
81
123
) ;
82
124
125
+ const annotationsExportQueue = new ApplicationSQSQueue (
126
+ this ,
127
+ 'annotations-export-consumer-queue' ,
128
+ {
129
+ name : config . envVars . annotationsExportQueueName ,
130
+ tags : config . tags ,
131
+ visibilityTimeoutSeconds : 1800 ,
132
+ messageRetentionSeconds : 1209600 , //14 days
133
+ //need to set maxReceiveCount to enable DLQ
134
+ maxReceiveCount : 3 ,
135
+ } ,
136
+ ) ;
137
+
83
138
new ApplicationSqsSnsTopicSubscription (
84
139
this ,
85
140
'list-events-sns-subscription' ,
86
141
{
87
- name : `${ config . envVars . listExportQueueName } -SNS` ,
142
+ name : `${ config . envVars . exportRequestQueueName } -SNS` ,
88
143
snsTopicArn : `arn:aws:sns:${ pocketVpc . region } :${ pocketVpc . accountId } :${ config . lambda . snsTopicName . listEvents } ` ,
89
- sqsQueue : listExportQueue . sqsQueue ,
144
+ sqsQueue : exportRequestQueue . sqsQueue ,
90
145
filterPolicyScope : 'MessageBody' ,
91
146
filterPolicy : JSON . stringify ( {
92
147
'detail-type' : [ 'list-export-requested' ] ,
@@ -193,6 +248,9 @@ class AccountDataDeleter extends TerraformStack {
193
248
snsTopic : this . getCodeDeploySnsTopic ( ) ,
194
249
batchDeleteQueue : batchDeleteQueue . sqsQueue ,
195
250
listExportQueue : listExportQueue . sqsQueue ,
251
+ exportRequestQueue : exportRequestQueue . sqsQueue ,
252
+ annotationsExportQueue : annotationsExportQueue . sqsQueue ,
253
+ exportStateDb : exportStateDb . dynamodb ,
196
254
listExportBucket : exportBucket ,
197
255
listExportPartsPrefix : partsPrefix ,
198
256
listExportArchivesPrefix : archivesPrefix ,
0 commit comments