-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathvariables.tf
562 lines (487 loc) · 14.5 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
variable "resource_group_name" {
description = <<EOT
The name of the resource group in which to create the AKS.
The Resource Group must already exist.
EOT
type = string
}
variable "public_ssh_key" {
description = <<EOT
The Public SSH Key used to access the cluster.
Changing this forces a new resource to be created.
EOT
type = string
default = ""
}
variable "name" {
description = <<EOT
The name of the Managed Kubernetes Cluster to create.
Changing this forces a new resource to be created.
EOT
type = string
validation {
condition = length(var.name) >= 1 && length(var.name) <= 63 && can(regex("^[a-zA-Z0-9][a-zA-Z0-9-_.]+[a-zA-Z0-9]$", var.name))
error_message = "Invalid name (check Azure Resource naming restrictions for more info)."
}
}
variable "dns_prefix" {
description = <<EOT
DNS prefix specified when creating the managed cluster.
Changing this forces a new resource to be created.
EOT
type = string
validation {
condition = length(var.dns_prefix) >= 3 && length(var.dns_prefix) <= 45 && can(regex("^[a-zA-Z][a-zA-Z0-9-]+[a-zA-Z0-9]$", var.dns_prefix))
error_message = "The dns_prefix must contain between 3 and 45 characters, and can contain only letters, numbers, and hyphens. It must start with a letter and must end with a letter or a number."
}
}
# start - default_node_pool block variables
variable "default_pool_name" {
description = <<EOT
The name which should be used for the default Kubernetes Node Pool.
Changing this forces a new resource to be created.
EOT
type = string
validation {
condition = length(var.default_pool_name) >= 1 && length(var.default_pool_name) <= 12 && can(regex("^[a-z][a-z0-9]+[a-z0-9]$", var.default_pool_name))
error_message = "Invalid node pool name (check Azure Resource naming restrictions for more info)."
}
}
variable "vm_size" {
description = "The size of the Virtual Machine, such as Standard_DS2_v2."
type = string
default = "Standard_D2s_v3"
}
variable "availability_zones" {
description = <<EOT
A list of Availability Zones across which the Node Pool should be spread.
Changing this forces a new resource to be created.
This requires that the type is set to VirtualMachineScaleSets and that
load_balancer_sku is set to Standard.
EOT
type = list(string)
default = null
}
variable "enable_auto_scaling" {
description = <<EOT
Should the Kubernetes Auto Scaler be enabled for this Node Pool?
This requires that the type is set to VirtualMachineScaleSets.
EOT
type = bool
default = false
}
variable "enable_host_encryption" {
description = <<EOT
Should the nodes in the Default Node Pool have host encryption enabled?
EOT
type = bool
default = false
}
variable "enable_node_public_ip" {
description = <<EOT
Should nodes in this Node Pool have a Public IP Address?
EOT
type = bool
default = false
}
variable "max_pods" {
description = <<EOT
The maximum number of pods that can run on each agent.
Changing this forces a new resource to be created.
EOT
type = number
default = null
}
variable "node_labels" {
description = <<EOT
A map of Kubernetes labels which should be applied to nodes in the Default Node Pool.
Changing this forces a new resource to be created.
EOT
type = map(string)
default = {}
}
variable "only_critical_addons_enabled" {
description = <<EOT
Enabling this option will taint default node pool with
CriticalAddonsOnly=true:NoSchedule taint.
Changing this forces a new resource to be created.
EOT
type = bool
default = false
}
variable "orchestrator_version" {
description = <<EOT
Version of Kubernetes used for the Agents. If not specified, the latest
recommended version will be used at provisioning time (but won't auto-upgrade)
EOT
type = string
default = null
}
variable "os_disk_size_gb" {
description = <<EOT
The size of the OS Disk which should be used for each agent in the Node Pool.
Changing this forces a new resource to be created.
EOT
type = number
default = null
}
variable "os_disk_type" {
description = <<EOT
The type of disk which should be used for the Operating System.
Possible values are Ephemeral and Managed.
Changing this forces a new resource to be created.
EOT
type = string
default = "Managed"
}
variable "agent_type" {
description = <<EOT
The type of Node Pool which should be created.
Possible values are AvailabilitySet and VirtualMachineScaleSets.
EOT
type = string
default = "VirtualMachineScaleSets"
}
variable "agent_tags" {
description = "A mapping of tags to assign to the Node Pool."
type = map(string)
default = {}
}
variable "vnet_subnet_id" {
description = <<EOT
The ID of a Subnet where the Kubernetes Node Pool should exist.
Changing this forces a new resource to be created.
EOT
type = string
default = null
}
variable "max_count" {
description = <<EOT
The maximum number of nodes which should exist in this Node Pool.
If specified this must be between 1 and 1000.
EOT
type = number
default = null
}
variable "min_count" {
description = <<EOT
The minimum number of nodes which should exist in this Node Pool.
If specified this must be between 1 and 1000.
EOT
type = number
default = null
}
variable "node_count" {
description = <<EOT
The initial number of nodes which should exist in this Node Pool. If specified
this must be between 1 and 1000 and between min_count and max_count.
EOT
type = number
default = 1
}
variable "max_surge" {
description = <<EOT
The maximum number or percentage of nodes which will be added to the Node Pool
size during an upgrade.
If a percentage is provided, the number of surge nodes is calculated from the
node_count value on the current cluster. Node surge can allow a cluster to
have more nodes than max_count during an upgrade.
EOT
type = string
default = null
}
variable "admin_username" {
description = <<EOT
The Admin Username for the Cluster.
Changing this forces a new resource to be created.
EOT
type = string
default = "azureuser"
}
# end - default_node_pool block variables
# start - identity/service_principal
variable "user_assigned_identity_ids" {
description = "The IDs of a user assigned identity."
type = list(string)
default = null
}
# end - identity/service_principal
# aci_connector_linux
variable "enable_aci_connector_linux" {
description = "Is the virtual node addon enabled?"
type = bool
default = false
}
variable "aci_connector_linux_subnet_name" {
description = <<EOT
The subnet name for the virtual nodes to run.
AKS will add a delegation to the subnet named here.
To prevent further runs from failing you should make sure that the subnet
you create for virtual nodes has a delegation, like so.
```hcl
resource "azurerm_subnet" "virtual" {
#...
delegation {
name = "aciDelegation"
service_delegation {
name = "Microsoft.ContainerInstance/containerGroups"
actions = ["Microsoft.Network/virtualNetworks/subnets/action"]
}
}
}
```
EOT
type = string
default = null
}
# start - role based access control
variable "enable_role_based_access_control" {
description = <<EOT
Is Role Based Access Control Enabled?
Changing this forces a new resource to be created.
EOT
type = bool
default = true
}
variable "enable_azure_active_directory" {
description = "Enable Azure Active Directory Integration?"
type = bool
default = false
}
variable "rbac_aad_managed" {
description = <<EOT
Is the Azure Active Directory integration Managed, meaning that Azure will
create/manage the Service Principal used for integration.
EOT
type = bool
default = false
}
variable "rbac_aad_admin_group_object_ids" {
description = "Object ID of groups with admin access."
type = list(string)
default = null
}
variable "rbac_aad_client_app_id" {
description = "The Client ID of an Azure Active Directory Application."
type = string
default = null
}
variable "rbac_aad_server_app_id" {
description = "The Server ID of an Azure Active Directory Application."
type = string
default = null
}
variable "rbac_aad_server_app_secret" {
description = "The Server Secret of an Azure Active Directory Application."
type = string
default = null
}
# end - role based access control
# start - network profile
variable "network_plugin" {
description = <<EOT
Network plugin to use for networking. Currently supported values are azure and kubenet.
Changing this forces a new resource to be created.
EOT
type = string
default = "kubenet"
}
variable "network_policy" {
description = <<EOT
Sets up network policy to be used with Azure CNI.
Currently supported values are calico and azure.
Changing this forces a new resource to be created.
EOT
type = string
default = null
}
variable "dns_service_ip" {
description = <<EOT
IP address within the Kubernetes service address range that will be used by
cluster service discovery (kube-dns).
Changing this forces a new resource to be created.
EOT
type = string
default = null
}
variable "outbound_type" {
description = <<EOT
The outbound (egress) routing method which should be used for this Kubernetes
Cluster. Possible values are loadBalancer and userDefinedRouting.
EOT
type = string
default = "loadBalancer"
}
variable "pod_cidr" {
description = <<EOT
The CIDR to use for pod IP addresses. This field can only be set when
network_plugin is set to kubenet.
Changing this forces a new resource to be created.
EOT
type = string
default = null
}
variable "service_cidr" {
description = <<EOT
The Network Range used by the Kubernetes service.
Changing this forces a new resource to be created.
EOT
type = string
default = null
}
variable "load_balancer_sku" {
description = <<EOT
Specifies the SKU of the Load Balancer used for this Kubernetes Cluster.
Possible values are Basic and Standard.
EOT
type = string
default = "Standard"
}
# end - network profile
variable "disk_encryption_set_id" {
description = <<EOT
(Optional) The ID of the Disk Encryption Set which should be used for the Nodes and Volumes.
Please see [the documentation](https://docs.microsoft.com/en-us/azure/aks/azure-disk-customer-managed-keys)
and [disk_encryption_set](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/disk_encryption_set)
for more information.
EOT
type = string
default = null
}
variable "kubernetes_version" {
description = <<EOT
Version of Kubernetes specified when creating the AKS managed cluster.
If not specified, the latest recommended version will be used at provisioning time (but won't auto-upgrade).
EOT
type = string
default = null
}
variable "node_resource_group" {
description = <<EOT
The name of the Resource Group where the Kubernetes Nodes should exist.
Changing this forces a new resource to be created.
Azure requires that a new, non-existent Resource Group is used, as otherwise the
provisioning of the Kubernetes Service will fail.
EOT
type = string
default = null
}
variable "private_cluster_enabled" {
description = <<EOT
Should this Kubernetes Cluster have its API server only exposed on internal
IP addresses? This provides a Private IP Address for the Kubernetes API on the
Virtual Network where the Kubernetes Cluster is located.
Changing this forces a new resource to be created.
EOT
type = bool
default = false
}
variable "sku_tier" {
description = <<EOT
The SKU Tier that should be used for this Kubernetes Cluster.
Possible values are Free and Paid (which includes the Uptime SLA).
EOT
type = string
default = "Free"
}
variable "private_dns_zone_id" {
description = <<EOT
Either the ID of Private DNS Zone which should be delegated to this Cluster,
or System to have AKS manage this.
If you use BYO DNS Zone, AKS cluster should either use a User Assigned Identity
or a service principal (which is deprecated) with the Private DNS Zone Contributor
role and access to this Private DNS Zone. If UserAssigned identity is used - to
prevent improper resource order destruction - cluster should depend on the role assignment
EOT
type = string
default = null
}
variable "tags" {
description = "A mapping of tags which should be assigned to Resources."
type = map(string)
default = {}
}
variable "enable_attach_acr" {
description = "Enable ACR Pull attach. Needs acr_id to be defined."
type = bool
default = false
}
variable "acr_id" {
description = "Attach ACR ID to allow ACR Pull from the SP/Managed Indentity."
type = string
default = ""
}
variable "node_pools" {
description = <<EOT
Allows to create multiple Node Pools.
node_pools can have more than one pool. The name attribute is used
to create key/value map, and priority is needed to filter, but all the other
elements are optional.
```hcl
node_pools = [
{
name = "user1"
priority = "Regular"
},
{
name = "spot1"
priority = "Spot"
}
]
```
Valid fields are:
* vm_size
* availability_zones
* enable_auto_scaling
* enable_host_encryption
* enable_node_public_ip
* eviction_policy
* max_pods
* mode
* node_labels
* node_taints
* orchestrator_version
* os_disk_size_gb
* os_disk_type
* os_type
* priority
* spto_max_price
* tags
* max_count
* min_count
* node_count
* max_surge
EOT
type = any
default = []
}
variable "api_server_authorized_ip_ranges" {
type = set(string)
default = null
description = "(Optional) The IP ranges to allow for incoming traffic to the server nodes."
}
variable "api_server_subnet_id" {
type = string
default = null
description = "(Optional) The ID of the Subnet where the API server endpoint is delegated to."
}
variable "rbac_aad" {
type = bool
default = true
description = "(Optional) Is Azure Active Directory integration enabled?"
}
variable "rbac_aad_azure_rbac_enabled" {
type = bool
default = null
description = "(Optional) Is Role Based Access Control based on Azure AD enabled?"
}
variable "rbac_aad_tenant_id" {
type = string
default = null
description = "(Optional) The Tenant ID used for Azure Active Directory Application. If this isn't specified the Tenant ID of the current Subscription is used."
}
variable "role_based_access_control_enabled" {
type = bool
default = false
description = "Enable Role Based Access Control."
}