-
Notifications
You must be signed in to change notification settings - Fork 0
/
variables-eks.tf
510 lines (427 loc) · 14.4 KB
/
variables-eks.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
# File auto-generated by ./bin/make-example-vars
#### Cluster ####
#################
variable "cluster_name" {
description = "EKS cluster name."
type = string
}
variable "kubernetes_version" {
description = "Kubernetes controlplane version."
type = string
default = "1.29"
}
variable "aws_region" {
description = "AWS Region."
type = string
}
variable "aws_account_id" {
description = "AWS Account ID to restrict resources. This is a safety measurement to avoid creating/destroying in the wrong account."
type = string
}
variable "tags" {
description = "Tags to apply to all resources."
type = any
default = {
"managed-by" : "terraform"
}
}
variable "overlay" {
description = "Map of variables to inject into overlay files."
type = map(string)
default = {
certmanager_acme_email : ""
cronitor_ping_url : ""
ecr_credential_sync_region : ""
msteams_channel_url : ""
opencost_spot_datafeed_bucket_name : ""
opencost_spot_datafeed_bucket_prefix : ""
opencost_storage_class_name : ""
opsgenie_integration_api_key : ""
pagerduty_service_key : ""
slack_api_url : ""
slack_channel : ""
teleport_auth_token : ""
}
}
#### Encryption ####
####################
variable "cluster_encryption_config" {
description = "Configuration block with encryption configuration for the cluster. To disable secret encryption, set this value to `{}`"
type = any
default = {
resources = ["secrets"]
}
}
#### Network ####
#################
## Use an existing VPC
variable "vpc_id" {
description = "VPC ID of an existing VPC. Set to disable VPC creation."
type = string
default = ""
}
variable "private_subnet_ids" {
description = "Private Subnet IDs of an existing VPC."
type = list(string)
default = []
}
variable "public_subnet_ids" {
description = "Public Subnet IDs of an existing VPC."
type = list(string)
default = []
}
variable "control_plane_subnet_ids" {
description = "Control Plane Subnet IDs of an existing VPC."
type = list(string)
default = []
}
## Create a new VPC
variable "vpc_name" {
description = "VPC name to create new VPC. Defaults to cluster name."
type = string
default = ""
}
variable "vpc_zones" {
description = "AZ names to create the subnets. Use 'aws ec2 describe-availability-zones --region <region> | jq .AvailabilityZones[].ZoneName' to list all available subnets."
type = list(string)
}
variable "vpc_cidr" {
description = "VPC CIDR to create new VPC."
type = string
default = "10.0.0.0/16"
}
## Security Groups
variable "create_cluster_security_group" {
description = "Determines if a security group is created for the cluster. Note: the EKS service creates a primary security group for the cluster by default"
type = bool
default = true
}
variable "cluster_security_group_id" {
description = "Existing security group ID to be attached to the cluster."
type = string
default = ""
}
variable "cluster_security_group_name" {
description = "Name to use on cluster security group created."
type = string
default = null
}
## API Endpoint
variable "cluster_endpoint_public_access_cidrs" {
description = "List of CIDR blocks. Indicates which CIDR blocks can access the Amazon EKS public API server endpoint when enabled."
type = list(string)
default = ["0.0.0.0/0"]
}
variable "cluster_endpoint_public_access" {
description = "Indicates whether or not the Amazon EKS public API server endpoint is enabled."
type = bool
default = false
}
#### Plugins ####
#################
## VPC CNI
variable "vpc_cni_enable_prefix_delegation" {
description = "Increases Pod density by assigning EC2 ENIs with IP addresses prefixes instead a single IP. Reference docs https://docs.aws.amazon.com/eks/latest/userguide/cni-increase-ip-addresses.html."
type = bool
default = true
}
variable "kube_proxy" {
description = "Kube-proxy addon configurations."
type = object({
mode : optional(string, "iptables"),
resources : optional(any, {}),
ipvs : optional(object({
scheduler : optional(string, "rr")
}), {})
})
default = {}
}
#### Fargate ####
#################
variable "fargate_profiles" {
description = "List of fargate profiles to create. To disable fargate, set this value to `[]`."
type = any # list(object({namespace: string, labels: map(string)}))
default = [
{ namespace : "kube-system", labels : { "eks.amazonaws.com/component" : "coredns" } },
{ namespace : "kube-system", labels : { "app.kubernetes.io/component" : "csi-driver" } },
{ namespace : "keda", labels : { "app.kubernetes.io/name" : "keda-operator" } },
# karpenter now requires EksPodIdentity, which is unavailable from fargate nodes
# { namespace : "karpenter", labels : { "app.kubernetes.io/name" : "karpenter" } },
{ namespace : "getup", labels : { "app" : "teleport-agent" } },
]
}
#### Fallback (Static) Node Group ####
######################################
variable "fallback_node_group_min_size" {
description = "Min number of instances/nodes."
type = number
default = 0
nullable = false
}
variable "fallback_node_group_max_size" {
description = "Max number of instances/nodes."
type = number
default = 1
nullable = false
}
variable "fallback_node_group_desired_size" {
description = "Desired number of instances/nodes."
type = number
default = 0
nullable = false
}
variable "fallback_node_group_capacity_type" {
description = " of capacity associated with the EKS Node Group. Valid values: `ON_DEMAND`, `SPOT`."
type = string
default = "ON_DEMAND"
}
variable "fallback_node_group_instance_types" {
description = "Set of instance types associated with the EKS Node Group."
type = list(string)
default = ["c5.large", "c5.xlarge", "m5.large", "m5.xlarge", "r5.large", "r5.xlarge"]
}
variable "fallback_node_group_ami_type" {
description = "Type of Amazon Machine Image (AMI) associated with the EKS Node Group. Valid values are `AL2_x86_64`, `AL2_x86_64_GPU`, `AL2_ARM_64`, `CUSTOM`, `BOTTLEROCKET_ARM_64`, `BOTTLEROCKET_x86_64`."
type = string
default = "BOTTLEROCKET_x86_64"
validation {
condition = contains(
[
"AL2_x86_64",
"AL2_x86_64_GPU",
"AL2_ARM_64",
"CUSTOM",
"BOTTLEROCKET_ARM_64",
"BOTTLEROCKET_x86_64",
"BOTTLEROCKET_ARM_64_NVIDIA",
"BOTTLEROCKET_x86_64_NVIDIA",
#"WINDOWS_CORE_2019_x86_64",
#"WINDOWS_FULL_2019_x86_64",
#"WINDOWS_CORE_2022_x86_64",
#"WINDOWS_FULL_2022_x86_64",
"AL2023_x86_64_STANDARD",
"AL2023_ARM_64_STANDARD"
],
var.fallback_node_group_ami_type)
error_message = "Invalid value: fallback_node_group_ami_type"
}
}
variable "fallback_node_group_platform" {
description = "Identifies if the OS platform is `bottlerocket` or `linux` based; `windows` is not supported."
type = string
default = "bottlerocket"
}
variable "fallback_node_group_disk_size" {
description = "Disk size in GiB for worker nodes. Defaults to 60."
type = number
default = 60
}
variable "fallback_node_group_disk_type" {
description = "Disk type to use on the worker nodes. Defaults to gp3."
type = string
default = "gp3"
}
#### Karpenter ####
###################
variable "karpenter_enabled" {
description = "Install Karpenter."
type = bool
default = true
}
variable "karpenter_namespace" {
description = "Namespace where to install Karpenter."
type = string
default = "karpenter"
}
variable "karpenter_version" {
description = "Karpenter chart version."
type = string
default = "0.36.1"
}
variable "karpenter_replicas" {
description = "Number of pods for Karpenter controller."
type = number
default = 2
}
variable "karpenter_node_class_ami_family" {
description = "Identifies if the OS platform is `Bottlerocket` or `AL2` based."
type = string
default = "Bottlerocket"
validation {
condition = contains(["Bottlerocket", "AL2", "AL2023", "Ubuntu"], var.karpenter_node_class_ami_family)
error_message = "Invalid value: karpenter_node_class_ami_family"
}
}
variable "karpenter_node_pool_instance_arch" {
description = "CPU Architecture for node pool instances. Valid values are `amd64` and `arm64`."
type = list(string)
default = ["amd64"]
validation {
condition = alltrue([for arch in var.karpenter_node_pool_instance_arch : contains(["amd64", "arm64"], arch)])
error_message = "Invalid value: karpenter_node_pool_instance_arch must be one of \"amd64\" or \"arm64\""
}
}
variable "karpenter_node_pool_instance_category" {
description = "EC2 Instance categories for both OnDemand and Spot Karpenter node pools."
type = list(string)
default = ["c", "m", "r"]
}
variable "karpenter_node_group_spot_ratio" {
description = "Ratio of On-Demand/Spot nodes created managed Karpenter."
type = number
default = 0.7
validation {
condition = var.karpenter_node_group_spot_ratio >= 0 && var.karpenter_node_group_spot_ratio <= 1
error_message = "Invalid value: karpenter_node_group_spot_ratio must be in the range [0..1]."
}
}
variable "karpenter_node_pool_instance_cpu" {
description = "EC2 Instance vCPUs for both OnDemand and Spot Karpenter node pools."
type = list(string)
default = ["2", "4", "8"]
}
variable "karpenter_node_pool_instance_memory_gb" {
description = "EC2 Instance memory size in GBi for both OnDemand and Spot Karpenter node pools."
type = list(number)
default = [4, 8, 16]
}
variable "karpenter_cluster_limits_memory_gb" {
description = "Overall EC2 Instance maximum memory size in GBi for both OnDemand and Spot Karpenter node pools. This respects proportions from var.karpenter_node_group_spot_ratio."
type = number
default = 1024
}
variable "karpenter_cluster_limits_cpu" {
description = "Overall EC2 Instance maximum vCPUs for both OnDemand and Spot Karpenter node pools. This respects proportions from var.karpenter_node_group_spot_ratio."
type = number
default = 1000
}
#### IAM ####
#############
variable "eks_iam_role_name" {
description = "IAM role name to create for EKS."
type = string
default = ""
}
variable "iam_role_use_name_prefix" {
description = "Determines whether the IAM role name (`iam_role_name`) is used as a prefix"
type = bool
default = true
}
variable "iam_role_arn" {
description = "Existing IAM role ARN for the cluster."
type = string
default = null
}
variable "kms_key_administrators" {
description = "A list of IAM ARNs for [key administrators](https://docs.aws.amazon.com/kms/latest/developerguide/key-policy-default.html#key-policy-default-allow-administrators). If no value is provided, the current caller identity is used to ensure at least one key admin is available"
type = list(string)
default = []
}
## AWS Auth ConfigMap ##
variable "create_aws_auth_configmap" {
description = "Determines whether to create the aws-auth configmap. NOTE - this is only intended for scenarios where the configmap does not exist (i.e. - when using only self-managed node groups). Most users should use `manage_aws_auth_configmap`"
type = bool
default = false
}
variable "manage_aws_auth_configmap" {
description = "Determines whether to manage the aws-auth configmap"
type = bool
default = true
}
variable "aws_auth_user_arns" {
description = "List of user ARNs to add to the aws-auth configmap. K8s username will be the last component of the ARN."
type = list(string)
default = []
}
variable "aws_auth_users" {
description = "List of user maps to add to the aws-auth configmap"
type = list(any)
default = []
}
variable "aws_auth_user_groups" {
description = "K8s group names to assign for all ARN users to add to the aws-auth configmap"
type = list(string)
default = ["system:masters"]
}
variable "aws_auth_role_arns" {
description = "List of roles ARNs to add to the aws-auth configmap. K8s username will be the last component of the ARN."
type = list(string)
default = []
}
variable "aws_auth_roles" {
description = "List of role maps to add to the aws-auth configmap"
type = list(any)
default = []
}
variable "aws_auth_role_groups" {
description = "K8s group names to assign for all ARN users to add to the aws-auth configmap"
type = list(string)
default = ["system:masters"]
}
variable "aws_auth_accounts" {
description = "List of account maps to add to the aws-auth configmap"
type = list(any)
default = []
}
#### KEDA ####
##############
variable "keda_namespace" {
description = "Namespace where to install Keda."
type = string
default = "keda"
}
variable "keda_version" {
description = "Keda chart version."
type = string
default = "2.12.1"
}
variable "keda_replicas" {
description = "Number of pods for Keda workloads."
type = number
default = 2
}
variable "keda_cron_schedule" {
description = "Timebased autoscale configurations."
type = list(object({
apiVersion = string
kind = string
name = string
namespace = string
minReplicaCount = number
maxReplicaCount = number
schedules = list(object({
timezone = string
start = string
end = string
desiredReplicas = string
}))
}))
default = []
}
#### Baloon Deploy #####
########################
variable "baloon_chart_version" {
description = "Baloon chart version."
type = string
default = "0.2.0"
}
variable "baloon_namespace" {
description = "Namespace to install baloon chart."
type = string
default = "default"
}
variable "baloon_replicas" {
description = "Number of pods for Baloon deployment (i.e. zero-resources usage pods). See https://wdenniss.com/gke-autopilot-spare-capacity for details."
type = number
default = 0
}
variable "baloon_cpu" {
description = "Request and limit CPU size for each baloon pod."
type = number
default = 1
}
variable "baloon_memory" {
description = "Request and limit memory size for each baloon pod."
type = string
default = "8Mi"
}