-
Notifications
You must be signed in to change notification settings - Fork 9
/
variables.tf
587 lines (527 loc) · 15.8 KB
/
variables.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
variable "create" {
type = bool
default = true
description = "Whether to create cluster and other resources or not"
}
#EKS
variable "cluster_name" {
type = string
description = "Creating eks cluster name."
}
variable "manage_aws_auth" {
type = bool
default = true
}
variable "worker_groups" {
type = any
default = {}
description = "Worker groups."
}
variable "node_groups" {
description = "Map of EKS managed node group definitions to create"
type = any
default = {
default = {
min_size = 2
max_size = 4
desired_size = 2
instance_types = ["t3.large"]
iam_role_additional_policies = ["arn:aws:iam::aws:policy/CloudWatchAgentServerPolicy"]
}
}
}
variable "node_security_group_additional_rules" {
type = any
default = {
ingress_cluster_8443 = {
description = "Metric server to node groups"
protocol = "tcp"
from_port = 8443
to_port = 8443
type = "ingress"
source_cluster_security_group = true
},
ingress_cluster_10250 = {
description = "Metric server to node groups"
protocol = "tcp"
from_port = 10250
to_port = 10250
type = "ingress"
self = true
}
}
}
variable "node_groups_default" {
description = "Map of EKS managed node group default configurations"
type = any
default = {
disk_size = 50
instance_types = ["t3.large"]
iam_role_additional_policies = ["arn:aws:iam::aws:policy/CloudWatchAgentServerPolicy"]
}
}
variable "workers_group_defaults" {
type = any
default = {
launch_template_use_name_prefix = true
launch_template_name = "default"
root_volume_type = "gp2"
root_volume_size = 50
}
description = "Worker group defaults."
}
variable "users" {
type = list(any)
default = []
description = "List of users to open eks cluster api access"
}
# ALB-INGRESS-CONTROLLER
variable "alb_log_bucket_path" {
type = string
default = ""
}
variable "send_alb_logs_to_cloudwatch" {
type = bool
default = true
description = "Whether send alb logs to CloudWatch or not."
}
variable "alb_log_bucket_name" {
type = string
default = ""
}
# FLUENT-BIT
variable "fluent_bit_configs" {
type = object({
enabled = optional(string, true)
fluent_bit_name = optional(string, "")
log_group_name = optional(string, "")
system_log_group_name = optional(string, "")
log_retention_days = optional(number, 90)
values_yaml = optional(string, "")
configs = optional(object({
inputs = optional(string, "")
filters = optional(string, "")
outputs = optional(string, "")
cloudwatch_outputs_enabled = optional(bool, true)
}), {})
drop_namespaces = optional(list(string), [])
log_filters = optional(list(string), [])
additional_log_filters = optional(list(string), [])
kube_namespaces = optional(list(string), [])
image_pull_secrets = optional(list(string), [])
})
default = {
enabled = true
fluent_bit_name = ""
log_group_name = ""
system_log_group_name = ""
log_retention_days = 90
values_yaml = ""
image_pull_secrets = []
configs = {
inputs = ""
outputs = ""
filters = ""
cloudwatch_outputs_enabled = true # whether to disable default cloudwatch exporter/output
}
drop_namespaces = [
"kube-system",
"opentelemetry-operator-system",
"adot",
"cert-manager",
"opentelemetry.*",
"meta.*",
]
log_filters = [
"kube-probe",
"health",
"prometheus",
"liveness"
]
additional_log_filters = [
"ELB-HealthChecker",
"Amazon-Route53-Health-Check-Service",
]
kube_namespaces = [
"kube.*",
"meta.*",
"adot.*",
"devops.*",
"cert-manager.*",
"git.*",
"opentelemetry.*",
"stakater.*",
"renovate.*"
]
}
description = "Fluent Bit configs"
}
# METRICS-SERVER
variable "enable_metrics_server" {
type = bool
default = false
}
variable "metrics_server_name" {
type = string
default = "metrics-server"
}
variable "cluster_endpoint_public_access" {
type = bool
default = true
}
variable "external_secrets_namespace" {
type = string
description = "The namespace of external-secret operator"
default = "kube-system"
}
variable "cluster_enabled_log_types" {
description = "A list of the desired control plane logs to enable. For more information, see Amazon EKS Control Plane Logging documentation (https://docs.aws.amazon.com/eks/latest/userguide/control-plane-logs.html)"
type = list(string)
default = []
}
variable "cluster_version" {
description = "Allows to set/change kubernetes cluster version, kubernetes version needs to be updated at leas once a year. Please check here for available versions https://docs.aws.amazon.com/eks/latest/userguide/kubernetes-versions.html"
type = string
default = "1.27"
}
variable "map_roles" {
description = "Additional IAM roles to add to the aws-auth configmap."
type = list(object({
rolearn = string
username = string
groups = list(string)
}))
default = []
}
variable "weave_scope_config" {
description = "Weave scope namespace configuration variables"
type = object({
create_namespace = bool
namespace = string
annotations = map(string)
ingress_host = string
ingress_class = string
ingress_name = string
service_type = string
weave_helm_release_name = string
})
default = {
create_namespace = true
namespace = "meta-system"
annotations = {}
ingress_host = ""
ingress_class = ""
service_type = "NodePort"
weave_helm_release_name = "weave"
ingress_name = "weave-ingress"
}
}
variable "weave_scope_enabled" {
description = "Weather enable Weave Scope or not"
type = bool
default = false
}
variable "bindings" {
description = "Variable which describes group and role binding"
type = list(object({
group = string
namespace = string
roles = list(string)
}))
default = []
}
variable "roles" {
description = "Variable describes which role will user have K8s"
type = list(object({
actions = list(string)
resources = list(string)
}))
default = []
}
variable "enable_sso_rbac" {
description = "Enable SSO RBAC integration or not"
type = bool
default = false
}
variable "account_id" {
type = string
default = null
description = "AWS Account Id to apply changes into"
}
variable "region" {
type = string
default = null
description = "AWS Region name."
}
variable "vpc" {
type = object({
# for linking using existing vpc
link = optional(object({
id = string
private_subnet_ids = list(string) # please have the existing vpc public/private subnets(at least 2 needed) tagged with corresponding tags(look into create case subnet tags defaults)
}), { id = null, private_subnet_ids = null })
# for creating new vpc
create = optional(object({
name = string
availability_zones = list(string)
cidr = string
private_subnets = list(string)
public_subnets = list(string)
public_subnet_tags = optional(map(any), {}) # to pass additional tags for public subnet or override default ones. The default ones are: {"kubernetes.io/cluster/${var.cluster_name}" = "shared","kubernetes.io/role/elb" = 1}
private_subnet_tags = optional(map(any), {}) # to pass additional tags for public subnet or override default ones. The default ones are: {"kubernetes.io/cluster/${var.cluster_name}" = "shared","kubernetes.io/role/internal-elb" = 1}
}), { name = null, availability_zones = null, cidr = null, private_subnets = null, public_subnets = null })
})
# default = {}
description = "VPC configuration for eks, we support both cases create new vpc(create field) and using already created one(link)"
validation {
condition = (try(var.vpc.link.id, null) != null || try(var.vpc.create.name, null) != null) && (try(var.vpc.link.id, null) == null || try(var.vpc.create.name, null) == null)
error_message = "One of(just one, not both) vpc.link.* and vpc.create.* field list is must to set for vpc configuration"
}
}
variable "metrics_exporter" {
type = string
default = "adot"
description = "Metrics Exporter, can use cloudwatch or adot"
}
variable "nginx_ingress_controller_config" {
type = object({
enabled = optional(bool, false)
name = optional(string, "nginx")
create_namespace = optional(bool, true)
namespace = optional(string, "ingress-nginx")
replicacount = optional(number, 3)
metrics_enabled = optional(bool, true)
})
default = {
enabled = false
name = "nginx"
create_namespace = true
namespace = "ingress-nginx"
replicacount = 3
metrics_enabled = true
}
description = "Nginx ingress controller configs"
}
variable "adot_config" {
description = "accept_namespace_regex defines the list of namespaces from which metrics will be exported, and additional_metrics defines additional metrics to export."
type = object({
accept_namespace_regex = optional(string, "(default|kube-system)")
additional_metrics = optional(list(string), [])
log_group_name = optional(string, "adot")
log_retention = optional(number, 14)
helm_values = optional(any, null)
logging_enable = optional(bool, false)
resources = optional(object({
limit = object({
cpu = optional(string, "200m")
memory = optional(string, "200Mi")
})
requests = object({
cpu = optional(string, "200m")
memory = optional(string, "200Mi")
})
}), {
limit = {
cpu = "200m"
memory = "200Mi"
}
requests = {
cpu = "200m"
memory = "200Mi"
}
})
})
default = {
accept_namespace_regex = "(default|kube-system)"
additional_metrics = []
log_group_name = "adot"
log_retention = 14
logging_enable = false
helm_values = null
resources = {
limit = {
cpu = "200m"
memory = "200Mi"
}
requests = {
cpu = "200m"
memory = "200Mi"
}
}
}
}
variable "adot_version" {
description = "The version of the AWS Distro for OpenTelemetry addon to use."
type = string
default = "v0.78.0-eksbuild.1"
}
variable "enable_kube_state_metrics" {
type = bool
default = false
description = "Enable kube-state-metrics"
}
// Cert manager
// If you want enable ADOT you should enable cert_manager
variable "create_cert_manager" {
description = "If enabled it always gets deployed to the cert-manager namespace."
type = bool
default = false
}
variable "enable_efs_driver" {
type = bool
default = false
description = "Weather install EFS driver or not in EKS"
}
variable "efs_storage_classes" {
description = "Additional storage class configurations: by default, 2 storage classes are created - efs-sc and efs-sc-root which has 0 uid. One can add another storage classes besides these 2."
type = list(object({
name : string
provisioning_mode : optional(string, "efs-ap")
file_system_id : string
directory_perms : optional(string, "755")
base_path : optional(string, "/")
uid : optional(number)
}))
default = []
}
variable "efs_id" {
description = "EFS filesystem id in AWS"
type = string
default = null
}
variable "autoscaling" {
description = "Weather enable autoscaling or not in EKS"
type = bool
default = true
}
variable "autoscaler_image_patch" {
type = number
description = "The patch number of autoscaler image"
default = 0
}
variable "scale_down_unneeded_time" {
type = number
description = "Scale down unneeded in minutes"
default = 2
}
variable "enable_ebs_driver" {
description = "Weather enable EBS-CSI driver or not"
type = bool
default = true
}
variable "ebs_csi_version" {
description = "EBS CSI driver addon version"
type = string
default = "v1.15.0-eksbuild.1"
}
variable "autoscaler_limits" {
type = object({
cpu = string
memory = string
})
default = {
cpu = "100m"
memory = "600Mi"
}
}
variable "autoscaler_requests" {
type = object({
cpu = string
memory = string
})
default = {
cpu = "100m"
memory = "600Mi"
}
}
variable "enable_api_gw_controller" {
description = "Weather enable API-GW controller or not"
type = bool
default = false
}
variable "api_gw_deploy_region" {
description = "Region in which API gatewat will be configured"
type = string
default = ""
}
variable "api_gateway_resources" {
description = "Nested map containing API, Stage, and VPC Link resources"
default = []
type = list(object({
namespace = string
api = object({
name = string
protocolType = string
})
stages = optional(list(object({
name = string
namespace = string
apiRef_name = string
stageName = string
autoDeploy = bool
description = string
})))
vpc_links = optional(list(object({
name = string
namespace = string
})))
}))
}
variable "enable_node_problem_detector" {
type = bool
default = true
}
variable "enable_olm" {
type = bool
default = false
description = "To install OLM controller (experimental)."
}
variable "prometheus_metrics" {
description = "Prometheus Metrics"
type = any
default = []
}
variable "enable_portainer" {
description = "Enable Portainer provisioning or not"
type = bool
default = false
}
variable "portainer_config" {
description = "Portainer hostname and ingress config."
type = object({
host = optional(string, "portainer.dasmeta.com")
enable_ingress = optional(bool, true)
})
default = {}
}
variable "enable_waf_for_alb" {
type = bool
description = "Enables WAF and WAF V2 addons for ALB"
default = false
}
variable "alarms" {
type = object({
enabled = optional(bool, true)
sns_topic = string
custom_values = optional(any, {})
})
description = "Alarms enabled by default you need set sns topic name for send alarms for customize alarms threshold use custom_values"
}
variable "additional_priority_classes" {
type = list(object({
name = string
value = string # number in string form
}))
description = "Defines Priority Classes in Kubernetes, used to assign different levels of priority to pods. By default, this module creates three Priority Classes: 'high'(1000000), 'medium'(500000) and 'low'(250000) . You can also provide a custom list of Priority Classes if needed."
default = []
}
variable "external_dns" {
type = object({
enabled = optional(bool, false)
configs = optional(any, {})
})
default = {
enabled = false
}
description = "Allows to install external-dns helm chart and related roles, which allows to automatically create R53 records based on ingress/service domain/host configs"
}