forked from AaronForce1/terraform-aws-infrastructure-eks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
variables.tf
491 lines (447 loc) · 14.1 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
## GLOBAL VAR CONFIGURATION
variable "aws_region" {
description = "AWS Region for all primary configurations"
}
variable "aws_secondary_region" {
description = "Secondary Region for certain redundant AWS components"
}
variable "aws_profile" {
description = "AWS Profile"
default = ""
}
variable "tech_email" {
description = "Tech Contact E-Mail for services such as LetsEncrypt"
}
variable "map_accounts" {
description = "Additional AWS account numbers to add to the aws-auth configmap."
type = list(string)
default = []
# default = [
# "777777777777",
# "888888888888",
# ]
}
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 = []
# default = [
# {
# rolearn = "arn:aws:iam::66666666666:role/role1"
# username = "role1"
# groups = ["system:masters"]
# },
# ]
}
variable "map_users" {
description = "Additional IAM users to add to the aws-auth configmap."
type = list(object({
userarn = string
username = string
groups = list(string)
}))
default = []
# default = [
# {
# userarn = "arn:aws:iam::66666666666:user/user1"
# username = "user1"
# groups = ["system:masters"]
# },
# {
# userarn = "arn:aws:iam::66666666666:user/user2"
# username = "user2"
# groups = ["system:masters"]
# },
# ]
}
variable "eks_managed_node_groups" {
description = "Override default 'single nodegroup, on a private subnet' with more advaned configuration archetypes"
default = []
type = any
# type = list(object({
# name = string
# desired_capacity = number
# max_capacity = number
# min_capacity = number
# instance_type = string
# ami_type = optional(string)
# key_name = optional(string)
# public_ip = optional(bool)
# create_launch_template = bool
# disk_size = number
# disk_encrypted = optional(bool)
# capacity_type = optional(string)
# taints = optional(list(object({
# key = string
# value = string
# effect = string
# affinity_label = bool
# })))
# subnet_selections = object({
# public = bool
# private = bool
# })
# tags = optional(any)
# }))
}
variable "cluster_root_domain" {
description = "Domain root where all kubernetes systems are orchestrating control"
type = object({
create = optional(bool)
name = string
ingress_records = optional(list(string))
})
}
# TODO: Modularise better
variable "operator_domain_name" {
description = "Domain root of operator cluster"
type = string
default = ""
}
variable "app_name" {
description = "Application Name"
default = "eks"
}
variable "app_namespace" {
description = "Tagged App Namespace"
}
variable "tfenv" {
description = "Environment"
}
variable "cluster_name" {
description = "Optional override for cluster name instead of standard {name}-{namespace}-{env}"
default = ""
}
variable "cluster_version" {
description = "Kubernetes Cluster Version"
default = "1.21"
}
variable "instance_type" {
# Standard Types (M | L | XL | XXL): m5.large | c5.xlarge | t3a.2xlarge | m5a.2xlarge
description = "AWS Instance Type for provisioning"
default = "c5a.medium"
}
variable "instance_desired_size" {
description = "Count of instances to be spun up within the context of a kubernetes cluster. Minimum: 2"
default = 2
}
variable "instance_min_size" {
description = "Count of instances to be spun up within the context of a kubernetes cluster. Minimum: 2"
default = 1
}
variable "instance_max_size" {
description = "Count of instances to be spun up within the context of a kubernetes cluster. Minimum: 2"
default = 4
}
variable "billingcustomer" {
description = "Which Billingcustomer, aka Cost Center, is responsible for this infra provisioning"
}
variable "root_vol_size" {
description = "Root Volume Size"
default = "50"
}
variable "node_key_name" {
description = "EKS Node Key Name"
default = ""
}
variable "node_public_ip" {
description = "assign public ip on the nodes"
default = false
}
variable "cluster_addons" {
description = "An add-on is software that provides supporting operational capabilities to Kubernetes applications, but is not specific to the application: coredns, kube-proxy, vpc-cni"
default = {
coredns = {
resolve_conflicts = "OVERWRITE"
}
kube-proxy = {}
vpc-cni = {
resolve_conflicts = "OVERWRITE"
}
kube-proxy = {}
}
type = any
}
variable "autoscaling_configuration" {
type = object({
scale_down_util_threshold = number
skip_nodes_with_local_storage = bool
skip_nodes_with_system_pods = bool
cordon_node_before_term = bool
})
default = {
scale_down_util_threshold = 0.7
skip_nodes_with_local_storage = false
skip_nodes_with_system_pods = false
cordon_node_before_term = true
}
}
variable "vpc_flow_logs" {
description = "Manually enable or disable VPC flow logs; Please note, for production, these are enabled by default otherwise they will be disabled; setting a value for this object will override all defaults regardless of environment"
type = object({
enabled = optional(bool)
})
default = {}
}
variable "elastic_ip_custom_configuration" {
description = "By default, this module will provision new Elastic IPs for the VPC's NAT Gateways; however, one can also override and specify separate, pre-existing elastic IPs as needed in order to preserve IPs that are whitelisted; reminder that the list of EIPs should have the same count as nat gateways created."
type = object({
enabled = bool
reuse_nat_ips = optional(bool)
external_nat_ip_ids = optional(list(string))
})
default = {
enabled = false
external_nat_ip_ids = []
reuse_nat_ips = false
}
}
variable "nat_gateway_custom_configuration" {
description = "Override the default NAT Gateway configuration, which configures a single NAT gateway for non-prod, while one per AZ on tfenv=prod"
type = object({
enabled = bool
enable_nat_gateway = bool
enable_dns_hostnames = bool
single_nat_gateway = bool
one_nat_gateway_per_az = bool
enable_vpn_gateway = bool
propagate_public_route_tables_vgw = bool
})
default = {
enable_dns_hostnames = true
enable_nat_gateway = true
enable_vpn_gateway = false
enabled = false
one_nat_gateway_per_az = true
propagate_public_route_tables_vgw = false
single_nat_gateway = false
}
}
variable "aws_installations" {
description = "AWS Support Components including Cluster Autoscaler, EBS/EFS Storage Classes, etc."
type = object({
storage_ebs = optional(object({
eks_irsa_role = bool
gp2 = bool
gp3 = bool
st1 = bool
}))
storage_efs = optional(object({
eks_irsa_role = bool
eks_security_groups = bool
efs = bool
}))
cluster_autoscaler = optional(bool)
route53_external_dns = optional(bool)
kms_secrets_access = optional(bool)
cert_manager = optional(bool)
})
default = {
cluster_autoscaler = true
kms_secrets_access = true
route53_external_dns = true
cert_manager = true
storage_ebs = {
eks_irsa_role = true
gp2 = true
gp3 = true
st1 = true
}
storage_efs = {
efs = true
eks_irsa_role = true
eks_security_groups = true
}
}
}
variable "helm_installations" {
type = object({
dashboard = bool
gitlab_runner = bool
gitlab_k8s_agent = bool
vault_consul = bool
ingress = bool
elasticstack = bool
monitoring = bool
argocd = bool
stakater_reloader = bool
metrics_server = bool
})
default = {
dashboard = false
gitlab_runner = false
gitlab_k8s_agent = false
vault_consul = false
ingress = true
elasticstack = false
monitoring = true
argocd = false
stakater_reloader = false
metrics_server = true
}
}
variable "helm_configurations" {
type = object({
dashboard = optional(string)
gitlab_runner = optional(string)
vault_consul = optional(object({
consul_values = optional(string)
vault_values = optional(string)
enable_aws_vault_unseal = optional(bool) # If Vault is enabled and deployed, by default, the unseal process is manual; Changing this to true allows for automatic unseal using AWS KMS"
vault_nodeselector = optional(string) # Allow for vault node selectors without extensive reconfiguration of the standard values file
vault_tolerations = optional(string) # Allow for tolerating certain taint on nodes, example usage, string:'NoExecute:we_love_hashicorp:true'
}))
ingress = optional(object({
nginx_values = optional(string)
certmanager_values = optional(string)
}))
elasticstack = optional(string)
monitoring = optional(object({
values = optional(string)
version = optional(string)
}))
argocd = optional(object({
value_file = optional(string)
application_set = optional(list(string))
repository_secrets = optional(list(object({
name = string
url = string
type = string
username = string
password = string
secrets_store = string
})))
credential_templates = optional(list(object({
name = string
url = string
username = string
password = string
secrets_store = string
})))
registry_secrets = optional(list(object({
name = string
username = string
password = string
url = string
email = string
secrets_store = string
})))
generate_plugin_repository_secret = optional(bool)
}))
})
default = {
dashboard = null
gitlab_runner = null
vault_consul = null
ingress = null
elasticstack = null
monitoring = null
argocd = null
}
}
variable "custom_namespaces" {
description = "Adding namespaces to a default cluster provisioning process"
type = list(string)
default = []
}
variable "custom_aws_s3_support_infra" {
description = "Adding the ability to provision additional support infrastructure required for certain EKS Helm chart/App-of-App Components"
type = list(object({
name = string
bucket_acl = string
aws_kms_key_id = optional(string)
lifecycle_rules = any
versioning = bool
k8s_namespace_service_account_access = any
}))
default = []
}
variable "vpc_subnet_configuration" {
type = object({
base_cidr = string
subnet_bit_interval = object({
public = number
private = number
})
autogenerate = optional(bool)
})
description = "Configure VPC CIDR and relative subnet intervals for generating a VPC. If not specified, default values will be generated."
default = {
base_cidr = "172.%s.0.0/16"
subnet_bit_interval = {
public = 2
private = 6
}
autogenerate = true
}
}
variable "google_clientID" {
description = "Used for Infrastructure OAuth: Google Auth Client ID"
}
variable "google_clientSecret" {
description = "Used for Infrastructure OAuth: Google Auth Client Secret"
}
variable "google_authDomain" {
description = "Used for Infrastructure OAuth: Google Auth Domain"
}
variable "create_launch_template" {
description = "enable launch template on node group"
default = false
}
variable "cluster_endpoint_public_access_cidrs" {
description = "If the cluster endpoint is to be exposed to the public internet, specify CIDRs here that it should be restricted to"
type = list(string)
default = []
}
## TODO: Merge all the default node_group configurations together
variable "default_ami_type" {
description = "Default AMI used for node provisioning"
default = "AL2_x86_64"
}
variable "gitlab_kubernetes_agent_config" {
description = "Configuration for Gitlab Kubernetes Agent"
type = object({
gitlab_agent_url = string
gitlab_agent_secret = string
})
sensitive = true
default = {
gitlab_agent_url = ""
gitlab_agent_secret = ""
}
}
variable "default_capacity_type" {
description = "Default capacity configuraiton used for node provisioning. Valid values: `ON_DEMAND, SPOT`"
default = "ON_DEMAND"
}
variable "registry_credentials" {
description = "Create list of registry credential for different namespaces, username and password are fetched from AWS parameter store"
type = list(object({
name = string
namespace = string
docker_username = string
docker_password = string
docker_server = string
docker_email = string
secrets_store = string
}))
default = []
}
variable "ipv6" {
type = object({
enable = bool
assign_ipv6_address_on_creation = bool
private_subnet_assign_ipv6_address_on_creation = bool
public_subnet_assign_ipv6_address_on_creation = bool
})
default = {
enable = false
assign_ipv6_address_on_creation = false
private_subnet_assign_ipv6_address_on_creation = false
public_subnet_assign_ipv6_address_on_creation = false
}
}