-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
614 lines (552 loc) · 16.7 KB
/
main.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
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
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
provider "azurerm" {
tenant_id = module.azure_credentials.tenant_id
subscription_id = module.azure_credentials.subscription_id
client_id = module.azure_credentials.client_id
client_secret = module.azure_credentials.client_secret
features {}
}
module "naming" {
source = "github.com/Azure-Terraform/example-naming-template.git?ref=v1.0.0"
}
resource "random_string" "random" {
length = 12
upper = false
number = false
special = false
}
data "azurerm_client_config" "current" {}
data "azurerm_subscription" "current" {}
data "http" "my_ip" {
url = "https://ifconfig.me"
}
module "metadata" {
source = "github.com/Azure-Terraform/terraform-azurerm-metadata.git?ref=v1.5.0"
naming_rules = module.naming.yaml
market = "us"
project = "hpccops"
location = "eastus2"
sre_team = "[email protected]"
environment = "sandbox"
product_name = "<product-name>"
business_unit = "infra"
product_group = "hpccops"
subscription_id = data.azurerm_subscription.current.subscription_id
subscription_type = "<lifecycle>"
resource_group_type = "app"
}
module "resource_group" {
source = "[email protected]:Azure-Terraform/terraform-azurerm-resource-group.git?ref=v2.1.0"
location = module.metadata.location
names = module.metadata.names
tags = module.metadata.tags
}
#############
##vnet##
#############
module "virtual_network" {
source = "tfe.lnrisk.io/Infrastructure/virtual-network/azurerm"
version = "6.0.0"
naming_rules = module.naming.yaml
resource_group_name = module.resource_group.name
location = module.resource_group.location
names = module.metadata.names
tags = module.metadata.tags
enforce_subnet_names = false
address_space = [var.cidr_block]
dns_servers = [local.firewall_ip]
route_tables = {
default = local.route_table
}
subnets = {
iaas-outbound = {
cidrs = [var.cidr_block_acr]
allow_internet_outbound = true
allow_lb_inbound = true
allow_vnet_inbound = true
allow_vnet_outbound = true
configure_nsg_rules = true
create_network_security_group = true
enforce_private_link_endpoint_network_policies = false
route_table_association = "default"
service_endpoints = ["Microsoft.Storage", "Microsoft.ContainerRegistry"]
}
}
aks_subnets = {
hpcc = {
subnet_info = {
cidrs = [var.cidr_block_app]
service_endpoints = ["Microsoft.Storage", "Microsoft.ContainerRegistry"]
enforce_private_link_endpoint_network_policies = true
enforce_private_link_service_network_policies = true
}
route_table = local.route_table
}
}
peers = {
expressroute = {
id = var.expressroute_id
allow_virtual_network_access = true
allow_forwarded_traffic = true
allow_gateway_transit = false
use_remote_gateways = true
}
}
}
# ############
# #aks##
# #############
module "aks" {
source = "[email protected]:LexisNexis-RBA/terraform-azurerm-aks.git?ref=v1.0.0-beta.26"
location = module.metadata.location
resource_group_name = module.resource_group.name
tags = module.metadata.tags
experimental = {
oms_agent = true
oms_log_analytics_workspace_id = azurerm_log_analytics_workspace.log.id
workspace_log_categories = "limited"
node_group_os_config = true
}
cluster_name = local.cluster_name
cluster_version = local.cluster_version
network_plugin = "kubenet"
sku_tier_paid = true
cluster_endpoint_public_access = true
cluster_endpoint_access_cidrs = ["0.0.0.0/0"]
virtual_network_resource_group_name = module.resource_group.name
virtual_network_name = module.virtual_network.vnet.name
subnet_name = module.virtual_network.aks.hpcc.subnet.name
route_table_name = module.virtual_network.aks.hpcc.route_table.name
dns_resource_group_lookup = { "${local.internal_domain}" = local.dns_resource_group }
admin_group_object_ids = [var.aad_group_id]
rbac_bindings = var.rbac_bindings
node_groups = local.node_groups
core_services_config = {
alertmanager = {
smtp_host = local.smtp_host
smtp_from = local.smtp_from
routes = local.alert_manager_routes
receivers = local.alert_manager_recievers
}
coredns = {
forward_zones = {
"risk.regn.net" = local.firewall_ip
"ins.risk.regn.net" = local.firewall_ip
"prg.risk.regn.net" = local.firewall_ip
"hc.risk.regn.net" = local.firewall_ip
"rs.lexisnexis.net" = local.firewall_ip
"noam.lnrm.net" = local.firewall_ip
"eu.lnrm.net" = local.firewall_ip
"seisint.com" = local.firewall_ip
"sds" = local.firewall_ip
"internal.sds" = local.firewall_ip
}
}
external_dns = {
zones = local.internal_domain
resource_group_name = local.dns_resource_group
}
cert_manager = {
letsencrypt_environment = "staging"
letsencrypt_email = null
dns_zones = {
"${local.internal_domain}" = local.dns_resource_group
}
}
grafana = {
admin_password = local.grafana_admin_password
}
ingress_internal_core = {
domain = local.internal_domain
subdomain_suffix = local.cluster_name_short
public_dns = true
}
ingress_core_internal = {
domain = local.internal_domain
}
}
}
# ##############
# ##acr###
# ##############
module "acr" {
source = "[email protected]:LexisNexis-RBA/terraform-azurerm-container-registry.git?ref=v2.4.0"
location = module.metadata.location
resource_group_name = module.resource_group.name
names = module.metadata.names
tags = module.metadata.tags
georeplications = [
{
location = "centralus"
tags = { "purpose" = "Primary DR Region" }
}
]
sku = "Premium"
admin_enabled = true
public_network_access_enabled = false
disable_unique_suffix = true
acr_admins = local.azuread_clusterrole_map.cluster_admin_users
acr_contributors = { aks = module.aks.kubelet_identity.object_id }
access_list = local.acr_trusted_ips
service_endpoints = {
"iaas-outbound" = module.virtual_network.subnets["iaas-outbound"].id
}
}
#################
##hpcc##
#################
module "hpcc" {
source = "[email protected]:LexisNexis-RBA/terraform-azurerm-hpcc.git?ref=main"
resource_group_name = module.resource_group.name
location = module.resource_group.location
tags = module.metadata.tags
environment = var.environment
productname = var.productname
cluster_name = local.cluster_name
internal_domain = local.internal_domain
namespace = {
name = "hpcc"
labels = {
name = "hpcc"
}
}
hpcc_container = var.jfrog_registry
hpcc_container_registry_auth = var.jfrog_auth
helm_chart_version = var.jfrog_registry.version
install_blob_csi_driver = true
enable_node_tuning = false
node_tuning_containers = var.node_tuning_containers
environment_variables = {
SMTPserver = "appmail-bct.risk.regn.net"
emailSenderAddress = "[email protected]"
subscription = local.account_code
}
admin_services_node_selector = { all = { workload = "servpool" } }
admin_services_storage_account_settings = {
replication_type = "ZRS"
authorized_ip_ranges = merge(var.storage_account_authorized_ip_ranges, { my_ip = data.http.my_ip.response_body })
delete_protection = false
subnet_ids = merge({
"aks-hpcc" = module.virtual_network.aks.hpcc.subnet.id
}, var.azure_admin_subnets)
}
data_storage_config = {
internal = {
blob_nfs = {
data_plane_count = var.hpcc_data_plane_count
storage_account_settings = {
replication_type = "ZRS"
authorized_ip_ranges = merge(var.storage_account_authorized_ip_ranges, { my_ip = data.http.my_ip.response_body })
delete_protection = false
subnet_ids = merge({
"aks-hpcc" = module.virtual_network.aks.hpcc.subnet.id
}, var.azure_admin_subnets)
}
}
hpc_cache = null
}
external = null
}
admin_services_storage = {
dali = {
size = 200
type = "azurefiles"
}
debug = {
size = 100
type = "blobnfs"
}
dll = {
size = 1000
type = "blobnfs"
}
lz = {
size = 1000
type = "blobnfs"
}
sasha = {
size = 10000
type = "blobnfs"
}
}
ldap_config = {}
# Example Ldap Config
# ldap_config = {
# dali = {
# adminGroupName = var.ldap_adminGroupName
# filesBasedn = var.ldap_filesBasedn
# groupsBasedn = var.ldap_groupsBasedn
# hpcc_admin_password = var.ldap_pass
# hpcc_admin_username = var.ldap_user
# ldap_admin_password = var.ldap_pass
# ldap_admin_username = var.ldap_user
# ldapAdminVaultId = ""
# resourcesBasedn = var.ldap_resourcesBasedn
# sudoersBasedn = var.ldap_sudoersBasedn
# systemBasedn = var.ldap_systemBasedn
# usersBasedn = var.ldap_usersBasedn
# workunitsBasedn = var.ldap_workunitsBasedn
# }
# esp = {
# adminGroupName = var.ldap_adminGroupName
# filesBasedn = var.ldap_filesBasedn
# groupsBasedn = var.ldap_groupsBasedn
# ldap_admin_password = var.ldap_pass
# ldap_admin_username = var.ldap_user
# ldapAdminVaultId = ""
# resourcesBasedn = var.ldap_resourcesBasedn
# sudoersBasedn = var.ldap_sudoersBasedn
# systemBasedn = var.ldap_systemBasedn
# usersBasedn = var.ldap_usersBasedn
# workunitsBasedn = var.ldap_workunitsBasedn
# }
# ldap_server = var.ldap_server
# }
dali_settings = {
coalescer = {
interval = 12
at = "* * * * *"
minDeltaSize = 50000
resources = {
cpu = "1"
memory = "4G"
}
}
resources = {
cpu = "4"
memory = "24G"
}
}
sasha_config = {
disabled = false
wu-archiver = {
disabled = false
service = {
servicePort = 8877
}
plane = "sasha"
interval = 6
limit = 1000
cutoff = 8
backup = 0
at = "* * * * *"
throttle = 0
retryinterval = 7
keepResultFiles = false
}
dfuwu-archiver = {
disabled = false
service = {
servicePort = 8877
}
plane = "sasha"
interval = 24
limit = 1000
cutoff = 14
at = "* * * * *"
throttle = 0
}
dfurecovery-archiver = {
disabled = false
interval = 12
limit = 20
cutoff = 4
at = "* * * * *"
}
file-expiry = {
disabled = false
interval = 1
at = "* * * * *"
persistExpiryDefault = 7
expiryDefault = 4
user = "sasha"
}
}
dfuserver_settings = {
maxJobs = 6
resources = {
cpu = "1"
memory = "2G"
}
}
spray_service_settings = {
replicas = 6
nodeSelector = "spraypool"
}
# Add your Firewall rules here, to which you need outbound connectivity.
egress_engine = {
engineEgress = [
{
to = [{
ipBlock = {
cidr = "10.9.8.7/32"
}
}]
ports = [
{
protocol = "TCP"
port = 443
}
]
}
]
}
eclagent_settings = {
hthor = {
replicas = 1
maxActive = 4
prefix = "hthor"
use_child_process = false
type = "hthor"
resources = {
cpu = "1"
memory = "4G"
}
egress = "engineEgress"
},
"roxie-workunit" = {
replicas = 1
maxActive = 20
prefix = "roxie-workunit"
use_child_process = true
type = "roxie"
resources = {
cpu = "1"
memory = "4G"
}
egress = "engineEgress"
}
}
spill_volume_size = 600 # maps to local ssd space specific to DDSv4 series, number in Gi
thor_config = [
{
name = "thor-nonphidelivery" #configmap throws errors if you include underbars, or if the name is longer than 27 characters (because it tries making a secret that needs to be 63 char or less
disabled = false
prefix = "thor-nonphidelivery"
numWorkers = 200
maxJobs = 12
maxGraphs = 6
maxGraphStartupTime = 172800
keepJobs = "none"
numWorkersPerPod = 1
nodeSelector = { workload = "thorpool" }
tolerations_value = "thorpool"
egress = "engineEgress"
managerResources = {
cpu = 2
memory = "8G"
}
workerResources = {
cpu = 4
memory = "16G"
}
workerMemory = {
query = "12G"
thirdParty = "500M"
}
eclAgentResources = {
cpu = 2
memory = "8G"
}
},
{
name = "thor-nonphideliveryuat"
disabled = false
prefix = "thor-nonphideliveryuat"
numWorkers = 200
maxJobs = 6
maxGraphs = 3
maxGraphStartupTime = 172800
keepJobs = "none"
numWorkersPerPod = 1
nodeSelector = { workload = "thorpool" }
tolerations_value = "thorpool"
egress = "engineEgress"
managerResources = {
cpu = 2
memory = "8G"
}
workerResources = {
cpu = 4
memory = "16G"
}
workerMemory = {
query = "12G"
thirdParty = "500M"
}
eclAgentResources = {
cpu = 2
memory = "8G"
}
}
]
eclccserver_settings = {
"myeclccserver" = {
useChildProcesses = false
replicas = 1
maxActive = 4
resources = {
cpu = "12"
memory = "48G"
}
egress = "engineEgress"
gitUsername = "svc-hpcc-pubrec-git"
childProcessTimeLimit = "86400"
defaultRepo = "<default repo>"
defaultRepoVersion = "data-build-prod"
}
}
vault_secrets = {
git_approle_secret = {
"git-approle-secret-one" = {
secret_name = "git-approle-secret-one"
secret_value = "<your_secret_id>"
}
},
ecl_approle_secret = null,
ecluser_approle_secret = {
"ecluser-approle-secret-one" = {
secret_name = "ecluser-approle-secret-one"
secret_value = "<your_secret_id>"
}
},
esp_approle_secret = {
"esp-approle-secret-one" = {
secret_name = "esp-approle-secret-one"
secret_value = "<your_secret_id>"
}
}
}
vault_config = {
git = {
"git-1" = {
name = "my-git-vault"
url : "<Your Vault URL>"
kind : "kv-v2"
role_id = "<your role_id>"
secret_name = "git-approle-secret-one"
vault_namespace = "hpccsystems"
},
}
ecl = null,
esp = {
"my-esp-vault" = {
name = "my-esp-vault"
url = "<Your Vault URL>"
kind = "kv-v2"
role_id = "<your role_id>"
secret_name = "esp-approle-secret-one"
vault_namespace = "hpccsystems"
}
},
ecluser = {
"my-eclUser-vault" = {
name = "my-eclUser-vault"
url = "<Your Vault URL>"
kind = "kv-v2"
role_id = "<your role_id>"
secret_name = "ecluser-approle-secret-one"
vault_namespace = "hpccsystems"
}
}
}
}