generated from MITLibraries/mitlib-tf-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtimdex_ecrs.tf
388 lines (373 loc) · 14.7 KB
/
timdex_ecrs.tf
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
###
### Timdex related ECR's
###
## oaiharvester
# oaiharvester ECR repo
module "ecr_oaiharvester" {
source = "./modules/ecr"
repo_name = "oai-pmh-harvester"
login_policy_arn = aws_iam_policy.login.arn
oidc_arn = data.aws_ssm_parameter.oidc_arn.value
environment = var.environment
tfoutput_ssm_path = var.tfoutput_ssm_path
tags = {
app-repo = "timdex-infrastructure-oaiharvester"
}
}
# Outputs in dev
output "oaiharvester_dev_build_workflow" {
value = var.environment == "prod" || var.environment == "stage" ? null : templatefile("${path.module}/files/dev-build.tpl", {
region = var.aws_region
role = module.ecr_oaiharvester.gha_role
ecr = module.ecr_oaiharvester.repository_name
function = ""
}
)
description = "Full contents of the dev-build.yml for the oaiharvester repo"
}
output "oaiharvester_makefile" {
value = var.environment == "prod" || var.environment == "stage" ? null : templatefile("${path.module}/files/makefile.tpl", {
ecr_name = module.ecr_oaiharvester.repository_name
ecr_url = module.ecr_oaiharvester.repository_url
function = ""
}
)
description = "Full contents of the Makefile for the oaiharvester repo (allows devs to push to Dev account only)"
}
# Outputs in stage
output "oaiharvester_stage_build_workflow" {
value = var.environment == "prod" || var.environment == "dev" ? null : templatefile("${path.module}/files/stage-build.tpl", {
region = var.aws_region
role = module.ecr_oaiharvester.gha_role
ecr = module.ecr_oaiharvester.repository_name
function = ""
}
)
description = "Full contents of the stage-build.yml for the oaiharvester repo"
}
# Outputs after promotion to prod
output "oaiharvester_prod_promote_workflow" {
value = var.environment == "stage" || var.environment == "dev" ? null : templatefile("${path.module}/files/prod-promote.tpl", {
region = var.aws_region
role_stage = "${module.ecr_oaiharvester.repo_name}-gha-stage"
role_prod = "${module.ecr_oaiharvester.repo_name}-gha-prod"
ecr_stage = "${module.ecr_oaiharvester.repo_name}-stage"
ecr_prod = "${module.ecr_oaiharvester.repo_name}-prod"
function = ""
}
)
description = "Full contents of the prod-promote.yml for the oaiharvester repo"
}
## transmogrifier
# transmogrifier ECR repository
module "ecr_timdex_transmogrifier" {
source = "./modules/ecr"
repo_name = "transmogrifier"
login_policy_arn = aws_iam_policy.login.arn
oidc_arn = data.aws_ssm_parameter.oidc_arn.value
environment = var.environment
tfoutput_ssm_path = var.tfoutput_ssm_path
tags = {
app-repo = "timdex-infrastructure-transmogrifier"
}
}
# Outputs in dev
output "transmogrifier_dev_build_workflow" {
value = var.environment == "prod" || var.environment == "stage" ? null : templatefile("${path.module}/files/dev-build.tpl", {
region = var.aws_region
role = module.ecr_timdex_transmogrifier.gha_role
ecr = module.ecr_timdex_transmogrifier.repository_name
function = ""
}
)
description = "Full contents of the dev-build.yml for the transmogrifier repo"
}
output "transmogrifier_makefile" {
value = var.environment == "prod" || var.environment == "stage" ? null : templatefile("${path.module}/files/makefile.tpl", {
ecr_name = module.ecr_timdex_transmogrifier.repository_name
ecr_url = module.ecr_timdex_transmogrifier.repository_url
function = ""
}
)
description = "Full contents of the Makefile for the transmogrifier repo (allows devs to push to Dev account only)"
}
# Outputs in stage
output "transmogrifier_stage_build_workflow" {
value = var.environment == "prod" || var.environment == "dev" ? null : templatefile("${path.module}/files/stage-build.tpl", {
region = var.aws_region
role = module.ecr_timdex_transmogrifier.gha_role
ecr = module.ecr_timdex_transmogrifier.repository_name
function = ""
}
)
description = "Full contents of the stage-build.yml for the transmogrifier repo"
}
# Outputs after promotion to prod
output "transmogrifier_prod_promote_workflow" {
value = var.environment == "stage" || var.environment == "dev" ? null : templatefile("${path.module}/files/prod-promote.tpl", {
region = var.aws_region
role_stage = "${module.ecr_timdex_transmogrifier.repo_name}-gha-stage"
role_prod = "${module.ecr_timdex_transmogrifier.repo_name}-gha-prod"
ecr_stage = "${module.ecr_timdex_transmogrifier.repo_name}-stage"
ecr_prod = "${module.ecr_timdex_transmogrifier.repo_name}-prod"
function = ""
}
)
description = "Full contents of the prod-promote.yml for the transmogrifier repo"
}
## timdex-pipeline-lambdas
# Since this is a Lambda function, we need to set the function name now in order to build the correct files.
locals {
ecr_timdex_lambdas_function_name = "timdex-format-${var.environment}"
}
module "ecr_timdex_lambdas" {
source = "./modules/ecr"
repo_name = "timdex-pipeline-lambdas"
login_policy_arn = aws_iam_policy.login.arn
oidc_arn = data.aws_ssm_parameter.oidc_arn.value
environment = var.environment
tfoutput_ssm_path = var.tfoutput_ssm_path
tags = {
app-repo = "timdex-infrastructure-pipeline-lambdas"
}
}
# Outputs in dev
output "timdex_lambdas_dev_build_workflow" {
value = var.environment == "prod" || var.environment == "stage" ? null : templatefile("${path.module}/files/dev-build.tpl", {
region = var.aws_region
role = module.ecr_timdex_lambdas.gha_role
ecr = module.ecr_timdex_lambdas.repository_name
function = local.ecr_timdex_lambdas_function_name
}
)
description = "Full contents of the dev-build.yml for the timdex-pipeline-lambdas repo"
}
output "timdex_lambdas_makefile" {
value = var.environment == "prod" || var.environment == "stage" ? null : templatefile("${path.module}/files/makefile.tpl", {
ecr_name = module.ecr_timdex_lambdas.repository_name
ecr_url = module.ecr_timdex_lambdas.repository_url
function = local.ecr_timdex_lambdas_function_name
}
)
description = "Full contents of the Makefile for the timdex-pipeline-lambdas repo (allows devs to push to Dev account only)"
}
# Outputs in stage
output "timdex_lambdas_stage_build_workflow" {
value = var.environment == "prod" || var.environment == "dev" ? null : templatefile("${path.module}/files/stage-build.tpl", {
region = var.aws_region
role = module.ecr_timdex_lambdas.gha_role
ecr = module.ecr_timdex_lambdas.repository_name
function = local.ecr_timdex_lambdas_function_name
}
)
description = "Full contents of the stage-build.yml for the timdex-pipeline-lambdas repo"
}
# Outputs after promotion to prod
output "timdex_lambdas_prod_promote_workflow" {
value = var.environment == "stage" || var.environment == "dev" ? null : templatefile("${path.module}/files/prod-promote.tpl", {
region = var.aws_region
role_stage = "${module.ecr_timdex_lambdas.repo_name}-gha-stage"
role_prod = "${module.ecr_timdex_lambdas.repo_name}-gha-prod"
ecr_stage = "${module.ecr_timdex_lambdas.repo_name}-stage"
ecr_prod = "${module.ecr_timdex_lambdas.repo_name}-prod"
function = local.ecr_timdex_lambdas_function_name
}
)
description = "Full contents of the prod-promote.yml for the timdex-pipeline-lambdas repo"
}
## timdex-index-manager
# timdex-index-manager ECR repository
module "ecr_timdex_tim" {
source = "./modules/ecr"
repo_name = "timdex-index-manager"
login_policy_arn = aws_iam_policy.login.arn
oidc_arn = data.aws_ssm_parameter.oidc_arn.value
environment = var.environment
tfoutput_ssm_path = var.tfoutput_ssm_path
tags = {
app-repo = "timdex-infrastructure-timdex-index-manager"
}
}
# Outputs in dev
output "tim_dev_build_workflow" {
value = var.environment == "prod" || var.environment == "stage" ? null : templatefile("${path.module}/files/dev-build.tpl", {
region = var.aws_region
role = module.ecr_timdex_tim.gha_role
ecr = module.ecr_timdex_tim.repository_name
function = ""
}
)
description = "Full contents of the dev-build.yml for the timdex-index-manager repo"
}
output "tim_makefile" {
value = var.environment == "prod" || var.environment == "stage" ? null : templatefile("${path.module}/files/makefile.tpl", {
ecr_name = module.ecr_timdex_tim.repository_name
ecr_url = module.ecr_timdex_tim.repository_url
function = ""
}
)
description = "Full contents of the Makefile for the timdex-index-manager repo (allows devs to push to Dev account only)"
}
# Outputs in stage
output "tim_stage_build_workflow" {
value = var.environment == "prod" || var.environment == "dev" ? null : templatefile("${path.module}/files/stage-build.tpl", {
region = var.aws_region
role = module.ecr_timdex_tim.gha_role
ecr = module.ecr_timdex_tim.repository_name
function = ""
}
)
description = "Full contents of the stage-build.yml for the timdex-index-manager repo"
}
# Outputs after promotion to prod
output "tim_prod_promote_workflow" {
value = var.environment == "stage" || var.environment == "dev" ? null : templatefile("${path.module}/files/prod-promote.tpl", {
region = var.aws_region
role_stage = "${module.ecr_timdex_tim.repo_name}-gha-stage"
role_prod = "${module.ecr_timdex_tim.repo_name}-gha-prod"
ecr_stage = "${module.ecr_timdex_tim.repo_name}-stage"
ecr_prod = "${module.ecr_timdex_tim.repo_name}-prod"
function = ""
}
)
description = "Full contents of the prod-promote.yml for the timdex-index-manager repo"
}
## browsertrix-harvester
# browsertrix-harvester ECR repository
module "ecr_timdex_browsertrix" {
source = "./modules/ecr"
repo_name = "browsertrix-harvester"
login_policy_arn = aws_iam_policy.login.arn
oidc_arn = data.aws_ssm_parameter.oidc_arn.value
environment = var.environment
tfoutput_ssm_path = var.tfoutput_ssm_path
tags = {
app-repo = "timdex-infrastructure-browsertrix"
}
}
# NEED TO FIX THE MISSPELLING!!!
moved {
from = module.ecr_timdex_broswertrix
to = module.ecr_timdex_browsertrix
}
# Outputs in dev
output "browsertrix_dev_build_workflow" {
value = var.environment == "prod" || var.environment == "stage" ? null : templatefile("${path.module}/files/dev-build.tpl", {
region = var.aws_region
role = module.ecr_timdex_browsertrix.gha_role
ecr = module.ecr_timdex_browsertrix.repository_name
function = ""
}
)
description = "Full contents of the dev-build.yml for the browsertrix-harvester repo"
}
# NEED TO FIX THE MISSPELLING!!!
moved {
from = output.broswertrix_dev_build_workflow
to = output.browsertrix_dev_build_workflow
}
output "browsertrix_makefile" {
value = var.environment == "prod" || var.environment == "stage" ? null : templatefile("${path.module}/files/makefile.tpl", {
ecr_name = module.ecr_timdex_browsertrix.repository_name
ecr_url = module.ecr_timdex_browsertrix.repository_url
function = ""
}
)
description = "Full contents of the Makefile for the browsertrix-harvester repo (allows devs to push to Dev account only)"
}
# NEED TO FIX THE MISSPELLING!!!
moved {
from = output.broswertrix_makefile
to = output.browsertrix_makefile
}
# Outputs in stage
output "browsertrix_stage_build_workflow" {
value = var.environment == "prod" || var.environment == "dev" ? null : templatefile("${path.module}/files/stage-build.tpl", {
region = var.aws_region
role = module.ecr_timdex_browsertrix.gha_role
ecr = module.ecr_timdex_browsertrix.repository_name
function = ""
}
)
description = "Full contents of the stage-build.yml for the browsertrix-harvester repo"
}
# NEED TO FIX THE MISSPELLING!!!
moved {
from = output.broswertrix_stage_build_workflow
to = output.browsertrix_stage_build_workflow
}
# Outputs after promotion to prod
output "browsertrix_prod_promote_workflow" {
value = var.environment == "stage" || var.environment == "dev" ? null : templatefile("${path.module}/files/prod-promote.tpl", {
region = var.aws_region
role_stage = "${module.ecr_timdex_browsertrix.repo_name}-gha-stage"
role_prod = "${module.ecr_timdex_browsertrix.repo_name}-gha-prod"
ecr_stage = "${module.ecr_timdex_browsertrix.repo_name}-stage"
ecr_prod = "${module.ecr_timdex_browsertrix.repo_name}-prod"
function = ""
}
)
description = "Full contents of the prod-promote.yml for the browsertrix-harvester repo"
}
# NEED TO FIX THE MISSPELLING!!!
moved {
from = output.broswertrix_prod_promote_workflow
to = output.browsertrix_prod_promote_workflow
}
## geo-harvester
# geo-harvester ECR repository
module "ecr_timdex_geo" {
source = "./modules/ecr"
repo_name = "geo-harvester"
login_policy_arn = aws_iam_policy.login.arn
oidc_arn = data.aws_ssm_parameter.oidc_arn.value
environment = var.environment
tfoutput_ssm_path = var.tfoutput_ssm_path
tags = {
app-repo = "timdex-infrastructure-geo"
}
}
# Outputs in dev
output "geo_dev_build_workflow" {
value = var.environment == "prod" || var.environment == "stage" ? null : templatefile("${path.module}/files/dev-build.tpl", {
region = var.aws_region
role = module.ecr_timdex_geo.gha_role
ecr = module.ecr_timdex_geo.repository_name
function = ""
}
)
description = "Full contents of the dev-build.yml for the geo-harvester repo"
}
output "geo_makefile" {
value = var.environment == "prod" || var.environment == "stage" ? null : templatefile("${path.module}/files/makefile.tpl", {
ecr_name = module.ecr_timdex_geo.repository_name
ecr_url = module.ecr_timdex_geo.repository_url
function = ""
}
)
description = "Full contents of the Makefile for the geo-harvester repo (allows devs to push to Dev account only)"
}
# Outputs in stage
output "geo_stage_build_workflow" {
value = var.environment == "prod" || var.environment == "dev" ? null : templatefile("${path.module}/files/stage-build.tpl", {
region = var.aws_region
role = module.ecr_timdex_geo.gha_role
ecr = module.ecr_timdex_geo.repository_name
function = ""
}
)
description = "Full contents of the stage-build.yml for the geo-harvester repo"
}
# Outputs after promotion to prod
output "geo_prod_promote_workflow" {
value = var.environment == "stage" || var.environment == "dev" ? null : templatefile("${path.module}/files/prod-promote.tpl", {
region = var.aws_region
role_stage = "${module.ecr_timdex_geo.repo_name}-gha-stage"
role_prod = "${module.ecr_timdex_geo.repo_name}-gha-prod"
ecr_stage = "${module.ecr_timdex_geo.repo_name}-stage"
ecr_prod = "${module.ecr_timdex_geo.repo_name}-prod"
function = ""
}
)
description = "Full contents of the prod-promote.yml for the geo-harvester repo"
}