-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathterragrunt.hcl
499 lines (470 loc) · 15.7 KB
/
terragrunt.hcl
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
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
locals {
account_ids = {
for name, env in local.environments : name => env.account_id
}
cidr_b_production = 1
cidr_b_staging = 2
cidr_b_development = 3
cidr_b_integration = 4
cidr_b_orchestrator = 5
cidr_b_external_integration = 6
environment = get_env("TG_ENVIRONMENT", "development")
is_production = contains(["production"], local.environment)
environments = {
orchestrator = {
cidr_block = "10.${local.cidr_b_orchestrator}.0.0/16"
account_id = 891377225335
name = "orchestrator"
postgres_instance_type = "db.t4g.micro"
private_subnets = [
"10.${local.cidr_b_orchestrator}.101.0/24",
"10.${local.cidr_b_orchestrator}.102.0/24",
"10.${local.cidr_b_orchestrator}.103.0/24"
]
public_subnets = [
"10.${local.cidr_b_orchestrator}.1.0/24",
"10.${local.cidr_b_orchestrator}.2.0/24",
"10.${local.cidr_b_orchestrator}.3.0/24"
]
top_level_domain = "findatender.codatt.net"
externals_cidr_block = "integration account feature" # To be deprecated after FTS Migration
externals_private_subnets = "integration account feature" # To be deprecated after FTS Migration
}
development = {
cidr_block = "10.${local.cidr_b_development}.0.0/16"
account_id = 471112892058
canary_schedule_expression = "rate(30 minutes)" # "cron(15 7,11,15 ? * MON-FRI)" # UTC+0
fts_azure_frontdoor = null
name = "dev"
onelogin_logout_notification_urls = [
"https://test-findtender.nqc.com/auth/backchannellogout",
"https://stanvolcere.nqc.com/auth/backchannellogout",
"https://nadeemshafi2.nqc.com/auth/backchannellogout"
]
pinned_service_version = null
postgres_instance_type = "db.t4g.micro"
private_subnets = [
"10.${local.cidr_b_development}.101.0/24",
"10.${local.cidr_b_development}.102.0/24",
"10.${local.cidr_b_development}.103.0/24"
]
public_subnets = [
"10.${local.cidr_b_development}.1.0/24",
"10.${local.cidr_b_development}.2.0/24",
"10.${local.cidr_b_development}.3.0/24"
]
top_level_domain = "findatender.codatt.net"
externals_cidr_block = "integration account feature" # To be deprecated after FTS Migration
externals_private_subnets = "integration account feature" # To be deprecated after FTS Migration
}
staging = {
cidr_block = "10.${local.cidr_b_staging}.0.0/16"
account_id = 905418042182
canary_schedule_expression = "rate(30 minutes)"
fts_azure_frontdoor = null
name = "staging"
onelogin_logout_notification_urls = ["https://sirsi-integration-findtender.nqc.com/auth/backchannellogout"]
pinned_service_version = "1.0.15"
postgres_instance_type = "db.t4g.micro"
private_subnets = [
"10.${local.cidr_b_staging}.101.0/24",
"10.${local.cidr_b_staging}.102.0/24",
"10.${local.cidr_b_staging}.103.0/24"
]
public_subnets = [
"10.${local.cidr_b_staging}.1.0/24",
"10.${local.cidr_b_staging}.2.0/24",
"10.${local.cidr_b_staging}.3.0/24"
]
top_level_domain = "findatender.codatt.net"
externals_cidr_block = "integration account feature" # To be deprecated after FTS Migration
externals_private_subnets = "integration account feature" # To be deprecated after FTS Migration
}
integration = {
cidr_block = "10.${local.cidr_b_integration}.0.0/16"
account_id = 767397666448
canary_schedule_expression = "rate(30 minutes)"
fts_azure_frontdoor = null
name = "integration"
onelogin_logout_notification_urls = ["https://test-findtender.nqc.com/auth/backchannellogout"]
pinned_service_version = "1.0.17"
postgres_instance_type = "db.t4g.micro"
private_subnets = [
"10.${local.cidr_b_integration}.101.0/24",
"10.${local.cidr_b_integration}.102.0/24",
"10.${local.cidr_b_integration}.103.0/24"
]
public_subnets = [
"10.${local.cidr_b_integration}.1.0/24",
"10.${local.cidr_b_integration}.2.0/24",
"10.${local.cidr_b_integration}.3.0/24"
]
top_level_domain = "findatender.codatt.net"
externals_cidr_block = "10.${local.cidr_b_external_integration}.0.0/16"
externals_private_subnets = [
"10.${local.cidr_b_external_integration}.101.0/24",
"10.${local.cidr_b_external_integration}.102.0/24",
"10.${local.cidr_b_external_integration}.103.0/24"
]
}
production = {
cidr_block = "10.${local.cidr_b_production}.0.0/16"
account_id = 471112843276
canary_schedule_expression = "rate(15 minutes)"
fts_azure_frontdoor = "nqc-front-door-uksouth.azurefd.net"
name = "production"
onelogin_logout_notification_urls = ["https://www.private-beta.find-tender.service.gov.uk/auth/backchannellogout"]
pinned_service_version = "1.0.15"
postgres_instance_type = "db.t4g.micro"
private_subnets = [
"10.${local.cidr_b_production}.101.0/24",
"10.${local.cidr_b_production}.102.0/24",
"10.${local.cidr_b_production}.103.0/24"
]
public_subnets = [
"10.${local.cidr_b_production}.1.0/24",
"10.${local.cidr_b_production}.2.0/24",
"10.${local.cidr_b_production}.3.0/24"
]
top_level_domain = "private-beta.find-tender.service.gov.uk"
externals_cidr_block = "integration account feature" # To be deprecated after FTS Migration
externals_private_subnets = "integration account feature" # To be deprecated after FTS Migration
}
}
fts_azure_frontdoor = try(local.environments[local.environment].fts_azure_frontdoor, null)
onelogin_logout_notification_urls = try(local.environments[local.environment].onelogin_logout_notification_urls, null)
pinned_service_version = try(local.environments[local.environment].pinned_service_version, null)
product = {
name = "CDP SIRSI"
resource_name = "cdp-sirsi"
public_hosted_zone = local.environment == "production" ? local.environments[local.environment].top_level_domain : "${local.environments[local.environment].name}.supplier.information.${local.environments[local.environment].top_level_domain}"
}
external_product = {
name = "CDP FTS"
resource_name = "cdp-sirsi-ext-fts"
mysql_access_allowed_ip_ranges = ["0.0.0.0/0"]
}
desired_count_non_production = 1
desired_count_production = 1
frontend_desired_count_non_production = 4
service_configs_scaling_non_production = {
authority = {
cpu = 256
desired_count = local.desired_count_non_production
memory = 512
}
av_scanner_app = {
cpu = 256
desired_count = local.desired_count_non_production
memory = 512
}
data_sharing = {
cpu = 256
desired_count = local.desired_count_non_production
memory = 512
}
entity_verification = {
cpu = 256
desired_count = local.desired_count_non_production
memory = 512
}
entity_verification_migrations = {
cpu = 256
desired_count = local.desired_count_non_production
memory = 512
}
forms = {
cpu = 256
desired_count = local.desired_count_non_production
memory = 512
}
organisation = {
cpu = 256
desired_count = local.desired_count_non_production
memory = 512
}
organisation_app = {
cpu = 256
desired_count = local.frontend_desired_count_non_production
memory = 512
}
organisation_information_migrations = {
cpu = 256
desired_count = local.desired_count_non_production
memory = 512
}
person = {
cpu = 256
desired_count = local.desired_count_non_production
memory = 512
}
tenant = {
cpu = 256
desired_count = local.desired_count_non_production
memory = 512
}
}
service_configs_scaling_production = {
authority = {
cpu = 256
desired_count = local.desired_count_production
memory = 512
}
av_scanner_app = {
cpu = 256
desired_count = local.desired_count_non_production
memory = 512
}
data_sharing = {
cpu = 256
desired_count = local.desired_count_production
memory = 512
}
entity_verification = {
cpu = 256
desired_count = local.desired_count_production
memory = 512
}
entity_verification_migrations = {
cpu = 256
desired_count = local.desired_count_production
memory = 512
}
forms = {
cpu = 256
desired_count = local.desired_count_production
memory = 512
}
organisation = {
cpu = 256
desired_count = local.desired_count_production
memory = 512
}
organisation_app = {
cpu = 256
desired_count = local.frontend_desired_count_non_production
memory = 512
}
organisation_information_migrations = {
cpu = 256
desired_count = local.desired_count_production
memory = 512
}
person = {
cpu = 256
desired_count = local.desired_count_production
memory = 512
}
tenant = {
cpu = 256
desired_count = local.desired_count_production
memory = 512
}
}
# @TODO (ABN) Remove me
desired_count_development = 1
service_configs_scaling_development = {
authority = {
cpu = 256
desired_count = local.desired_count_development
memory = 512
}
av_scanner_app = {
cpu = 256
desired_count = local.desired_count_non_production
memory = 512
}
data_sharing = {
cpu = 256
desired_count = local.desired_count_development
memory = 512
}
entity_verification = {
cpu = 256
desired_count = local.desired_count_development
memory = 512
}
entity_verification_migrations = {
cpu = 256
desired_count = local.desired_count_development
memory = 512
}
forms = {
cpu = 256
desired_count = local.desired_count_development
memory = 512
}
organisation = {
cpu = 256
desired_count = local.desired_count_development
memory = 512
}
organisation_app = {
cpu = 256
desired_count = local.frontend_desired_count_non_production
memory = 512
}
organisation_information_migrations = {
cpu = 256
desired_count = local.desired_count_development
memory = 512
}
person = {
cpu = 256
desired_count = local.desired_count_development
memory = 512
}
tenant = {
cpu = 256
desired_count = local.desired_count_development
memory = 512
}
}
service_configs_scaling = {
development = local.service_configs_scaling_development
staging = local.service_configs_scaling_non_production
integration = local.service_configs_scaling_non_production
}
service_configs_common = {
authority = {
name = "authority"
port = 8092
port_host = 8092
}
av_scanner_app = {
name = "av-scanner-app"
port = 8095
port_host = 8095
}
data_sharing = {
name = "data-sharing"
port = 8088
port_host = 8088
}
entity_verification = {
name = "entity-verification"
port = 8094
port_host = 8094
}
entity_verification_migrations = {
name = "entity-verification-migrations"
port = 9191
port_host = null
}
forms = {
name = "forms"
port = 8086
port_host = 8086
}
organisation = {
name = "organisation"
port = 8082
port_host = 8082
}
organisation_app = {
name = "organisation-app"
port = 8090
port_host = 80
}
organisation_information_migrations = {
name = "organisation-information-migrations"
port = 9090
port_host = null
}
person = {
name = "person"
port = 8084
port_host = 8084
}
tenant = {
name = "tenant"
port = 8080
port_host = 8080
}
}
service_configs = {
for key, value in try(local.service_configs_scaling[local.environment], local.service_configs_scaling_production) :
key => merge(value, local.service_configs_common[key])
}
tags = {
environment = local.environment
managed_by = "terragrunt"
}
tools_configs = {
clamav_rest = {
cpu = 1024
memory = 3072
name = "clamav-rest"
port = 9000
port_host = 9000
}
grafana = {
cpu = 256
memory = 512
name = "grafana"
port = 3000
port_host = 3000
}
healthcheck = {
cpu = 256
memory = 512
name = "healthcheck"
port = 3030
port_host = 3030
}
pgadmin = {
cpu = 256
memory = 512
name = "pgadmin"
port = 5050
port_host = 5050
}
}
tg = {
state_bucket = "tfstate-${local.product.resource_name}-${local.environment}-${get_aws_account_id()}"
state_key = "${path_relative_to_include()}/terraform.tfstate"
}
versions = {
postgres_engine = "16.3"
}
}
remote_state {
backend = "s3"
config = {
bucket = local.tg.state_bucket
disable_bucket_update = true
dynamodb_table = "terraform-locks"
encrypt = true
key = local.tg.state_key
region = "eu-west-2"
}
generate = {
path = "remote_state.tf"
if_exists = "overwrite"
}
}
generate provider {
path = "temp_providers.tf"
if_exists = "overwrite_terragrunt"
contents = file("../providers.tf")
}
inputs = {
environment = local.environment
externals_product = local.external_product
externals_vpc_cidr = local.environments[local.environment].externals_cidr_block
externals_vpc_private_subnets = local.environments[local.environment].externals_private_subnets
is_production = local.is_production
postgres_engine_version = local.versions.postgres_engine
postgres_instance_type = local.environments[local.environment].postgres_instance_type
product = local.product
tags = local.tags
vpc_cidr = local.environments[local.environment].cidr_block
vpc_private_subnets = local.environments[local.environment].private_subnets
vpc_public_subnets = local.environments[local.environment].public_subnets
}
terraform {
extra_arguments disable_input {
commands = get_terraform_commands_that_need_input()
arguments = ["-input=false"]
}
}