Skip to content

Commit f9e9465

Browse files
authored
feat: (IAC-750) Add type and description for all the variables in the variables.tf files (#291)
1 parent f373217 commit f9e9465

File tree

8 files changed

+414
-194
lines changed

8 files changed

+414
-194
lines changed

modules/aks_node_pool/variables.tf

Lines changed: 56 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,37 @@
11
# Copyright © 2020-2023, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
# REQUIRED variables (must be set by caller of the module)
5-
64
variable "node_pool_name" {
7-
type = string
5+
description = "The name of the Node Pool which should be created within the Kubernetes Cluster. Changing this forces a new resource to be created."
6+
type = string
87
}
98

109
variable "aks_cluster_id" {
11-
type = string
10+
description = "The ID of the Kubernetes Cluster where this Node Pool should exist. Changing this forces a new resource to be created."
11+
type = string
1212
}
1313

1414
variable "zones" {
15-
type = list(string)
16-
default = []
15+
description = "Specifies a list of Availability Zones in which this Kubernetes Cluster Node Pool should be located. Changing this forces a new Kubernetes Cluster Node Pool to be created."
16+
type = list(string)
17+
default = []
1718
}
1819

1920
variable "vnet_subnet_id" {
20-
default = null
21+
description = "The ID of the Subnet where this Node Pool should exist. Changing this forces a new resource to be created."
22+
type = string
23+
default = null
2124
}
2225

2326
variable "machine_type" {
24-
type = string
27+
description = "The SKU which should be used for the Virtual Machines used in this Node Pool. Changing this forces a new resource to be created."
28+
type = string
2529
}
2630

2731
variable "os_disk_size" {
28-
default = 100
32+
description = "The Agent Operating System disk size in GB. Changing this forces a new resource to be created."
33+
type = number
34+
default = 100
2935
}
3036

3137
# TODO: enable after azurerm v2.37.0
@@ -42,55 +48,45 @@ variable "os_type" {
4248
}
4349

4450
variable "node_count" {
45-
default = 1
51+
description = "The number of nodes which should exist within this Node Pool."
52+
type = number
53+
default = 1
4654
}
4755

4856
variable "enable_auto_scaling" {
49-
default = false
57+
description = "Whether to enable auto-scaler."
58+
type = bool
59+
default = false
5060
}
5161

52-
# For future - https://docs.microsoft.com/en-us/azure/aks/spot-node-pool
53-
#
54-
# variable "priority" {
55-
# description = "The Priority for Virtual Machines within the Virtual Machine Scale Set that powers this Node Pool. Possible values are Regular and Spot. Defaults to Regular. Changing this forces a new resource to be created."
56-
# type = string
57-
# default = "Regular"
58-
# }
59-
60-
# variable "eviction_policy" {
61-
# description = "The Eviction Policy which should be used for Virtual Machines within the Virtual Machine Scale Set powering this Node Pool. Possible values are Deallocate and Delete. Changing this forces a new resource to be created. An Eviction Policy can only be configured when priority is set to Spot"
62-
# type = string
63-
# default = null
64-
# }
65-
66-
# variable "spot_max_price" {
67-
# description = "The maximum price you're willing to pay in USD per Virtual Machine. Valid values are -1 (the current on-demand price for a Virtual Machine) or a positive value with up to five decimal places. Changing this forces a new resource to be created."
68-
# type = number
69-
# default = -1
70-
# }
71-
7262
variable "max_pods" {
7363
description = "The maximum number of pods that can run on each agent. Changing this forces a new resource to be created."
7464
type = number
7565
default = 110
7666
}
7767

7868
variable "max_nodes" {
79-
default = 1
69+
description = "The maximum number of nodes which should exist within this Node Pool."
70+
type = number
71+
default = 1
8072
}
8173

8274
variable "min_nodes" {
83-
default = 1
75+
description = "The minimum number of nodes which should exist within this Node Pool."
76+
type = number
77+
default = 1
8478
}
8579

8680
variable "node_taints" {
87-
type = list
81+
description = "A list of the taints added to new nodes during node pool create and scale. Changing this forces a new resource to be created."
82+
type = list(any)
8883
default = []
8984
}
9085

9186
variable "node_labels" {
92-
type = map
93-
default = {}
87+
description = "A map of Kubernetes labels which should be applied to nodes in this Node Pool."
88+
type = map(any)
89+
default = {}
9490
}
9591

9692
variable "orchestrator_version" {
@@ -100,10 +96,31 @@ variable "orchestrator_version" {
10096

10197
variable "tags" {
10298
description = "Map of tags to be placed on the Resources"
103-
type = map
99+
type = map(any)
104100
}
105101

106102
variable "proximity_placement_group_id" {
107-
type = string
108-
default = ""
103+
description = "The ID of the Proximity Placement Group where the Virtual Machine Scale Set that powers this Node Pool will be placed. Changing this forces a new resource to be created."
104+
type = string
105+
default = ""
109106
}
107+
108+
# For future - https://docs.microsoft.com/en-us/azure/aks/spot-node-pool
109+
#
110+
# variable "priority" {
111+
# description = "The Priority for Virtual Machines within the Virtual Machine Scale Set that powers this Node Pool. Possible values are Regular and Spot. Defaults to Regular. Changing this forces a new resource to be created."
112+
# type = string
113+
# default = "Regular"
114+
# }
115+
116+
# variable "eviction_policy" {
117+
# description = "The Eviction Policy which should be used for Virtual Machines within the Virtual Machine Scale Set powering this Node Pool. Possible values are Deallocate and Delete. Changing this forces a new resource to be created. An Eviction Policy can only be configured when priority is set to Spot"
118+
# type = string
119+
# default = null
120+
# }
121+
122+
# variable "spot_max_price" {
123+
# description = "The maximum price you're willing to pay in USD per Virtual Machine. Valid values are -1 (the current on-demand price for a Virtual Machine) or a positive value with up to five decimal places. Changing this forces a new resource to be created."
124+
# type = number
125+
# default = -1
126+
# }

modules/azure_aks/variables.tf

Lines changed: 81 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,126 @@
11
# Copyright © 2020-2023, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
variable aks_cluster_name {}
4+
variable "aks_cluster_name" {
5+
description = "The name for the AKS resources created in the specified Azure Resource Group"
6+
type = string
7+
}
8+
9+
variable "aks_cluster_rg" {
10+
description = "The resource group name to be imported"
11+
type = string
12+
}
513

6-
variable aks_cluster_rg {}
7-
variable aks_cluster_rg_id {}
8-
variable aks_cluster_dns_prefix {}
14+
variable "aks_cluster_rg_id" {
15+
description = "The `azurerm_kubernetes_cluster`'s id."
16+
type = string
17+
}
18+
19+
variable "aks_cluster_dns_prefix" {
20+
description = "DNS prefix specified when creating the managed cluster."
21+
type = string
22+
}
923

1024
variable "aks_cluster_location" {
1125
description = "The Azure Region in which all resources in this example should be provisioned"
26+
type = string
1227
default = "eastus"
1328
}
1429

15-
variable aks_cluster_sku_tier {
30+
variable "aks_cluster_sku_tier" {
1631
description = "The SKU Tier that should be used for this Kubernetes Cluster. Possible values are Free and Paid (which includes the Uptime SLA). Defaults to Free"
32+
type = string
1733
default = "Free"
1834

1935
validation {
20-
condition = contains(["Free", "Paid"], var.aks_cluster_sku_tier)
36+
condition = contains(["Free", "Paid"], var.aks_cluster_sku_tier)
2137
error_message = "ERROR: Valid types are \"Free\" and \"Paid\"!"
2238
}
2339
}
2440

2541
variable "aks_private_cluster" {
26-
default = false
42+
description = "Enables cluster API endpoint to use Private IP address"
43+
type = bool
44+
default = false
2745
}
2846

2947
variable "aks_cluster_node_count" {
30-
default = 4
48+
description = "(Required, when default_nodepool_auto_scaling=true) The minimum number of nodes which should exist in this Node Pool. If specified this must be between 1 and 100."
49+
type = number
50+
default = 4
3151
}
3252

33-
variable "aks_availability_zones" {}
53+
variable "aks_availability_zones" {
54+
description = "A list of Availability Zones across which the Node Pool should be spread. Changing this forces a new resource to be created."
55+
type = list(string)
56+
default = ["1"]
57+
}
3458

3559
# https://docs.microsoft.com/en-us/azure/virtual-machines/linux/sizes
3660
variable "aks_cluster_node_vm_size" {
37-
default = "Standard_D4_v2"
61+
description = "The default virtual machine size for the AKS cluster nodes"
62+
type = string
63+
default = "Standard_D4_v2"
3864
}
3965

4066
variable "aks_cluster_node_admin" {
41-
default = "ubuntu"
67+
description = "The operating system Admin User for VMs of AKS cluster nodes"
68+
type = string
69+
default = "ubuntu"
4270
}
4371

4472
variable "aks_cluster_ssh_public_key" {
45-
default = ""
73+
description = "A custom ssh key to control access to the AKS cluster. Changing this forces a new resource to be created."
74+
type = string
75+
default = ""
4676
}
4777

4878
# https://docs.microsoft.com/en-us/azure/aks/cluster-autoscaler
4979
variable "aks_cluster_node_auto_scaling" {
5080
description = "To enable auto-scaler to add nodes to AKS cluster"
81+
type = bool
5182
default = false
5283
}
5384

5485
variable "aks_cluster_min_nodes" {
5586
description = "(Required, when aks_cluster_node_auto_scaling=true) The minimum number of nodes which should exist in this Node Pool. If specified this must be between 1 and 100."
87+
type = number
5688
default = 1
5789
}
90+
5891
variable "aks_cluster_max_nodes" {
5992
description = "(Required, when aks_cluster_node_auto_scaling=true) The maximum number of nodes which should exist in this Node Pool. If specified this must be between 1 and 100."
93+
type = number
6094
default = 3
6195
}
96+
6297
variable "aks_cluster_os_disk_size" {
63-
description = "(Optional) 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."
98+
description = "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."
99+
type = number
64100
default = 128
65101
}
102+
66103
variable "aks_cluster_max_pods" {
67-
description = "(Optional) The maximum number of pods that can run on each agent. Changing this forces a new resource to be created."
104+
description = "The maximum number of pods that can run on each agent. Changing this forces a new resource to be created."
105+
type = number
68106
default = 110
69107
}
70108

71-
variable kubernetes_version {
109+
variable "kubernetes_version" {
72110
description = "The AKS cluster K8s version"
111+
type = string
73112
default = "1.24"
74113
}
114+
75115
variable "aks_cluster_endpoint_public_access_cidrs" {
76-
description = "Kubernetes cluster access IP ranges"
77-
type = list
116+
description = "Azure Kubernetes cluster access IP ranges"
117+
type = list(any)
78118
}
79119

80120
variable "aks_vnet_subnet_id" {
81-
default = null
121+
description = "The ID of a Subnet where the Kubernetes Node Pool should exist. Changing this forces a new resource to be created."
122+
type = string
123+
default = null
82124
}
83125

84126
variable "aks_network_plugin" {
@@ -106,6 +148,7 @@ variable "aks_dns_service_ip" {
106148

107149
variable "aks_docker_bridge_cidr" {
108150
description = "IP address (in CIDR notation) used as the Docker bridge IP address on nodes. Changing this forces a new resource to be created."
151+
type = string
109152
default = "172.17.0.1/16"
110153
validation {
111154
condition = var.aks_docker_bridge_cidr != null ? can(cidrnetmask(var.aks_docker_bridge_cidr)) : false
@@ -116,6 +159,7 @@ variable "aks_docker_bridge_cidr" {
116159

117160
variable "aks_pod_cidr" {
118161
description = "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."
162+
type = string
119163
default = "10.244.0.0/16"
120164
validation {
121165
condition = var.aks_pod_cidr != "" ? can(cidrnetmask(var.aks_pod_cidr)) : true
@@ -126,6 +170,7 @@ variable "aks_pod_cidr" {
126170

127171
variable "aks_service_cidr" {
128172
description = "The Network Range used by the Kubernetes service. Changing this forces a new resource to be created."
173+
type = string
129174
default = "10.0.0.0/16"
130175
validation {
131176
condition = var.aks_service_cidr != null ? can(cidrnetmask(var.aks_service_cidr)) : false
@@ -136,7 +181,7 @@ variable "aks_service_cidr" {
136181

137182
variable "aks_cluster_tags" {
138183
description = "Map of tags to be placed on the Resources"
139-
type = map
184+
type = map(any)
140185
}
141186

142187
variable "aks_oms_enabled" {
@@ -146,20 +191,29 @@ variable "aks_oms_enabled" {
146191

147192
variable "aks_log_analytics_workspace_id" {
148193
description = "The ID of the Log Analytics Workspace which the OMS Agent should send data to. Must be present if aks_oms_enabled is true"
194+
type = string
149195
}
150196

151-
variable "aks_uai_id"{
197+
variable "aks_uai_id" {
152198
description = "User assigned identity ID"
153-
default = null
154-
}
199+
type = string
200+
default = null
201+
}
155202

156-
variable client_id {
157-
default = ""
203+
variable "client_id" {
204+
description = "The Client ID for the Service Principal"
205+
type = string
206+
default = ""
158207
}
159-
variable client_secret {
160-
default = ""
208+
209+
variable "client_secret" {
210+
description = "The Client Secret for the Service Principal."
211+
type = string
212+
default = ""
161213
}
162214

163215
variable "cluster_egress_type" {
164-
default = "loadBalancer"
216+
description = "The outbound (egress) routing method which should be used for this Kubernetes Cluster. Possible values are loadBalancer and userDefinedRouting. Defaults to loadBalancer."
217+
type = string
218+
default = "loadBalancer"
165219
}

0 commit comments

Comments
 (0)