forked from GoogleCloudPlatform/cloud-foundation-fabric
-
Notifications
You must be signed in to change notification settings - Fork 0
/
variables.tf
235 lines (216 loc) · 6.53 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
/**
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
variable "cluster_id" {
description = "Cluster id. Optional, but providing cluster_id is recommended to prevent cluster misconfiguration in some of the edge cases."
type = string
default = null
}
variable "cluster_name" {
description = "Cluster name."
type = string
}
variable "gke_version" {
description = "Kubernetes nodes version. Ignored if auto_upgrade is set in management_config."
type = string
default = null
}
variable "k8s_labels" {
description = "Kubernetes labels applied to each node."
type = map(string)
default = {}
nullable = false
}
variable "labels" {
description = "The resource labels to be applied each node (vm)."
type = map(string)
default = {}
nullable = false
}
variable "location" {
description = "Cluster location."
type = string
}
variable "max_pods_per_node" {
description = "Maximum number of pods per node."
type = number
default = null
}
variable "name" {
description = "Optional nodepool name."
type = string
default = null
}
variable "node_config" {
description = "Node-level configuration."
type = object({
boot_disk_kms_key = optional(string)
disk_size_gb = optional(number)
disk_type = optional(string)
ephemeral_ssd_count = optional(number)
gcfs = optional(bool, false)
guest_accelerator = optional(object({
count = number
type = string
gpu_driver = optional(object({
version = string
partition_size = optional(string)
max_shared_clients_per_gpu = optional(number)
}))
}))
local_nvme_ssd_count = optional(number)
gvnic = optional(bool, false)
image_type = optional(string)
kubelet_config = optional(object({
cpu_manager_policy = string
cpu_cfs_quota = optional(bool)
cpu_cfs_quota_period = optional(string)
pod_pids_limit = optional(number)
}))
linux_node_config = optional(object({
sysctls = optional(map(string))
cgroup_mode = optional(string)
}))
local_ssd_count = optional(number)
machine_type = optional(string)
metadata = optional(map(string))
min_cpu_platform = optional(string)
preemptible = optional(bool)
sandbox_config_gvisor = optional(bool)
shielded_instance_config = optional(object({
enable_integrity_monitoring = optional(bool)
enable_secure_boot = optional(bool)
}))
spot = optional(bool)
workload_metadata_config_mode = optional(string)
})
default = {
disk_type = "pd-balanced"
}
validation {
condition = (
alltrue([
for k, v in try(var.node_config.guest_accelerator[0].gpu_driver, {}) : contains([
"GPU_DRIVER_VERSION_UNSPECIFIED", "INSTALLATION_DISABLED",
"DEFAULT", "LATEST"
], v.version)
])
)
error_message = "Invalid GPU driver version."
}
}
variable "node_count" {
description = "Number of nodes per instance group. Initial value can only be changed by recreation, current is ignored when autoscaling is used."
type = object({
current = optional(number)
initial = number
})
default = {
initial = 1
}
nullable = false
}
variable "node_locations" {
description = "Node locations."
type = list(string)
default = null
}
variable "nodepool_config" {
description = "Nodepool-level configuration."
type = object({
autoscaling = optional(object({
location_policy = optional(string)
max_node_count = optional(number)
min_node_count = optional(number)
use_total_nodes = optional(bool, false)
}))
management = optional(object({
auto_repair = optional(bool)
auto_upgrade = optional(bool)
}))
placement_policy = optional(object({
type = string
policy_name = optional(string)
tpu_topology = optional(string)
}))
queued_provisioning = optional(bool, false)
upgrade_settings = optional(object({
max_surge = number
max_unavailable = number
}))
})
default = null
}
variable "pod_range" {
description = "Pod secondary range configuration."
type = object({
secondary_pod_range = object({
name = string
cidr = optional(string)
create = optional(bool)
enable_private_nodes = optional(bool)
})
})
default = null
}
variable "project_id" {
description = "Cluster project id."
type = string
}
variable "reservation_affinity" {
description = "Configuration of the desired reservation which instances could take capacity from."
type = object({
consume_reservation_type = string
key = optional(string)
values = optional(list(string))
})
default = null
}
variable "service_account" {
description = "Nodepool service account. If this variable is set to null, the default GCE service account will be used. If set and email is null, a service account will be created. If scopes are null a default will be used."
type = object({
create = optional(bool, false)
email = optional(string)
oauth_scopes = optional(list(string))
})
default = {}
nullable = false
}
variable "sole_tenant_nodegroup" {
description = "Sole tenant node group."
type = string
default = null
}
variable "tags" {
description = "Network tags applied to nodes."
type = list(string)
default = null
}
variable "taints" {
description = "Kubernetes taints applied to all nodes."
type = map(object({
value = string
effect = string
}))
nullable = false
default = {}
validation {
condition = alltrue([
for k, v in var.taints :
contains(["NO_SCHEDULE", "PREFER_NO_SCHEDULE", "NO_EXECUTE"], v.effect)
])
error_message = "Invalid taint effect."
}
}