generated from MITLibraries/mitlib-tf-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathalmaintegrations-ecrs.tf
314 lines (291 loc) · 11.8 KB
/
almaintegrations-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
###
### ECRs for the various Alma integrations
###
################################################################################
## patronload
module "ecr_patronload" {
source = "./modules/ecr"
repo_name = "alma-patronload"
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 = "alma-patronload"
}
}
# Outputs in dev
output "patronload_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_patronload.gha_role
ecr = module.ecr_patronload.repository_name
function = ""
}
)
description = "Full contents of the dev-build.yml for the alma-patronload repo"
}
output "patronload_makefile" {
value = var.environment == "prod" || var.environment == "stage" ? null : templatefile("${path.module}/files/makefile.tpl", {
ecr_name = module.ecr_patronload.repository_name
ecr_url = module.ecr_patronload.repository_url
function = ""
}
)
description = "Full contents of the Makefile for the alma-patronload repo (allows devs to push to Dev account only)"
}
# Outputs in stage
output "patronload_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_patronload.gha_role
ecr = module.ecr_patronload.repository_name
function = ""
}
)
description = "Full contents of the stage-build.yml for the alma-patronload repo"
}
# Outputs after promotion to prod
output "patronload_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_patronload.repo_name}-gha-stage"
role_prod = "${module.ecr_patronload.repo_name}-gha-prod"
ecr_stage = "${module.ecr_patronload.repo_name}-stage"
ecr_prod = "${module.ecr_patronload.repo_name}-prod"
function = ""
}
)
description = "Full contents of the prod-promote.yml for the alma-patronload repo"
}
################################################################################
## creditcardslips
module "ecr_creditcardslips" {
source = "./modules/ecr"
repo_name = "alma-creditcardslips"
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 = "alma-creditcardslips"
}
}
# Outputs in dev
output "creditcardslips_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_creditcardslips.gha_role
ecr = module.ecr_creditcardslips.repository_name
function = ""
}
)
description = "Full contents of the dev-build.yml for the alma-creditcardslips repo"
}
output "creditcardslips_makefile" {
value = var.environment == "prod" || var.environment == "stage" ? null : templatefile("${path.module}/files/makefile.tpl", {
ecr_name = module.ecr_creditcardslips.repository_name
ecr_url = module.ecr_creditcardslips.repository_url
function = ""
}
)
description = "Full contents of the Makefile for the alma-creditcardslips repo (allows devs to push to Dev account only)"
}
# Outputs in stage
output "creditcardslips_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_creditcardslips.gha_role
ecr = module.ecr_creditcardslips.repository_name
function = ""
}
)
description = "Full contents of the stage-build.yml for the alma-creditcardslips repo"
}
# Outputs after promotion to prod
output "creditcardslips_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_creditcardslips.repo_name}-gha-stage"
role_prod = "${module.ecr_creditcardslips.repo_name}-gha-prod"
ecr_stage = "${module.ecr_creditcardslips.repo_name}-stage"
ecr_prod = "${module.ecr_creditcardslips.repo_name}-prod"
function = ""
}
)
description = "Full contents of the prod-promote.yml for the alma-creditcardslips repo"
}
################################################################################
## sapinvoices
module "ecr_sapinvoices" {
source = "./modules/ecr"
repo_name = "alma-sapinvoices"
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 = "alma-sapinvoices"
}
}
# Outputs in dev
output "sapinvoices_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_sapinvoices.gha_role
ecr = module.ecr_sapinvoices.repository_name
function = ""
}
)
description = "Full contents of the dev-build.yml for the alma-sapinvoices repo"
}
output "sapinvoices_makefile" {
value = var.environment == "prod" || var.environment == "stage" ? null : templatefile("${path.module}/files/makefile.tpl", {
ecr_name = module.ecr_sapinvoices.repository_name
ecr_url = module.ecr_sapinvoices.repository_url
function = ""
}
)
description = "Full contents of the Makefile for the alma-sapinvoices repo (allows devs to push to Dev account only)"
}
# Outputs in stage
output "sapinvoices_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_sapinvoices.gha_role
ecr = module.ecr_sapinvoices.repository_name
function = ""
}
)
description = "Full contents of the stage-build.yml for the alma-sapinvoices repo"
}
# Outputs after promotion to prod
output "sapinvoices_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_sapinvoices.repo_name}-gha-stage"
role_prod = "${module.ecr_sapinvoices.repo_name}-gha-prod"
ecr_stage = "${module.ecr_sapinvoices.repo_name}-stage"
ecr_prod = "${module.ecr_sapinvoices.repo_name}-prod"
function = ""
}
)
description = "Full contents of the prod-promote.yml for the alma-sapinvoices repo"
}
################################################################################
## sapinvoices-ui
locals {
ecr_sapinvoices_ui_function_name = "alma-sapinvoices-ui-${var.environment}"
}
module "ecr_sapinvoices_ui" {
source = "./modules/ecr"
repo_name = "alma-sapinvoices-ui"
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 = "alma-sapinvoices-ui"
}
}
# Outputs in dev
output "sapinvoices_ui_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_sapinvoices_ui.gha_role
ecr = module.ecr_sapinvoices_ui.repository_name
function = local.ecr_sapinvoices_ui_function_name
}
)
description = "Full contents of the dev-build.yml for the alma-sapinvoices-ui repo"
}
output "sapinvoices_ui_makefile" {
value = var.environment == "prod" || var.environment == "stage" ? null : templatefile("${path.module}/files/makefile.tpl", {
ecr_name = module.ecr_sapinvoices_ui.repository_name
ecr_url = module.ecr_sapinvoices_ui.repository_url
function = local.ecr_sapinvoices_ui_function_name
}
)
description = "Full contents of the Makefile for the alma-sapinvoices-ui repo (allows devs to push to Dev account only)"
}
# Outputs in stage
output "sapinvoices_ui_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_sapinvoices_ui.gha_role
ecr = module.ecr_sapinvoices_ui.repository_name
function = local.ecr_sapinvoices_ui_function_name
}
)
description = "Full contents of the stage-build.yml for the alma-sapinvoices-ui repo"
}
# Outputs after promotion to prod
output "sapinvoices_ui_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_sapinvoices_ui.repo_name}-gha-stage"
role_prod = "${module.ecr_sapinvoices_ui.repo_name}-gha-prod"
ecr_stage = "${module.ecr_sapinvoices_ui.repo_name}-stage"
ecr_prod = "${module.ecr_sapinvoices_ui.repo_name}-prod"
function = local.ecr_sapinvoices_ui_function_name
}
)
description = "Full contents of the prod-promote.yml for the alma-sapinvoices-ui repo"
}
################################################################################
## bursar transfer app
module "ecr_bursar" {
source = "./modules/ecr"
repo_name = "alma-bursartransfer"
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 = "alma-bursartransfer"
}
}
# Outputs in dev
output "bursar_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_bursar.gha_role
ecr = module.ecr_bursar.repository_name
function = ""
}
)
description = "Full contents of the dev-build.yml for the alma-bursartransfer repo"
}
output "bursar_makefile" {
value = var.environment == "prod" || var.environment == "stage" ? null : templatefile("${path.module}/files/makefile.tpl", {
ecr_name = module.ecr_bursar.repository_name
ecr_url = module.ecr_bursar.repository_url
function = ""
}
)
description = "Full contents of the Makefile for the alma-bursartransfer repo (allows devs to push to Dev account only)"
}
# Outputs in stage
output "bursar_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_bursar.gha_role
ecr = module.ecr_bursar.repository_name
function = ""
}
)
description = "Full contents of the stage-build.yml for the alma-bursartransfer repo"
}
# Outputs after promotion to prod
output "bursar_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_bursar.repo_name}-gha-stage"
role_prod = "${module.ecr_bursar.repo_name}-gha-prod"
ecr_stage = "${module.ecr_bursar.repo_name}-stage"
ecr_prod = "${module.ecr_bursar.repo_name}-prod"
function = ""
}
)
description = "Full contents of the prod-promote.yml for the alma-bursartransfer repo"
}