-
Notifications
You must be signed in to change notification settings - Fork 6
/
variables.tf
316 lines (284 loc) · 9.27 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
/**
* Copyright 2022 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 "name" {
type = string
description = "Name of the VM"
}
variable "namespace" {
type = string
default = "default"
description = "Namespace where the VM belongs to"
}
variable "is_windows" {
type = bool
default = false
description = "If the VM is a windows VM"
}
variable "guest_environment" {
type = object({
enable_access_management = optional(bool)
})
default = {
enable_access_management = true
}
description = <<EOT
The guest environment features.
enable_access_management : "Whether the SSH access management feature should be enabled."
EOT
}
variable "auto_restart_on_config_change" {
type = bool
default = false
description = "whether to automatically restart a VM to pick up configuration changes."
}
variable "scheduling" {
type = object({
nodeSelector = optional(map(string))
affinity = optional(any)
tolerations = optional(list(any))
})
default = null
description = <<EOT
nodeSelector : "The node labels that the host node of this VM must have."
affinity : "The affinity rules of the VM. The object needs to align with the k8s Affinity type."
tolerations : "Allows the VM to schedule onto nodes with matching taints. The list elements should have the type align with k8s Toleration type."
EOT
}
variable "cloudinit_nocloud" {
type = object({
secretRef = optional(object({
name = string
}))
userDataBase64 = optional(string)
userData = optional(string)
networkDataSecretRef = optional(object({
name = string
}))
networkDataBase64 = optional(string)
networkData = optional(string)
})
default = null
description = <<EOT
cloud-init nocloud source https://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html
secretRef : "Then name of a k8s secret that contains the userdata."
userDataBase64 : "Userdata as a base64 encoded string."
userData : "Inline userdata."
networkDataSecretRef : "The name of a k8s secret that contains the networkdata."
networkDataBase64 : "Networkdata as a base64 encoded string."
networkData : "Inline networkdata"
EOT
}
variable "startup_scripts" {
type = list(object({
name = string
script = optional(string)
scriptBase64 = optional(string)
scriptSecretRef = optional(object({
name = string
}))
}))
default = null
description = <<EOT
A list of startup scripts of the VM.
name : "The name of a script."
script : "The plain text string of the script."
scriptBase64 : "The base64 encoded string of the script."
scriptSecretRef : "The name of a k8s secret that contains the script."
EOT
}
# Disk Inputs
variable "boot_disk_name" {
type = string
default = ""
description = "The name of the existing boot disk in the same namespace."
}
variable "boot_disk_http_source" {
type = object({
url = string
secretRef = optional(string)
certConfigMap = optional(string)
extraHeaders = optional(list(string))
secretExtraHeaders = optional(list(string))
})
default = null
description = <<EOT
url : "URL of the http(s) endpoint"
secretRef : "A Secret reference which contains accessKeyId (user name) base64 encoded, and secretKey (password) also base64 encoded"
certConfigMap : "A configmap reference which contains a Certificate Authority(CA) public key, and a base64 encoded pem certificate"
extraHeaders : "A list of strings containing extra headers to include with HTTP transfer requests"
secretExtraHeaders : "A list of Secret references, each containing an extra HTTP header that may include sensitive information"
EOT
}
variable "boot_disk_gcs_source" {
type = object({
url = string
secretRef = optional(string)
})
default = null
description = <<EOT
url : "URL of the GCS source"
secretRef : "A Secret reference needed to access the GCS source"
EOT
}
variable "boot_disk_registry_source" {
type = object({
url = string
secretRef = optional(string)
certConfigMap = optional(string)
imageStream = optional(string)
pullMethod = optional(string)
})
default = null
description = <<EOT
url : "URL of the registry source (starting with the scheme: docker, oci-archive)"
secretRef : "A Secret reference needed to access the Registry source"
certConfigMap : "A configmap reference provides registry certs"
imageStream : "The name of image stream for import"
pullMethod : "pullMethod can be either "pod" (default import), or "node" (node docker cache based import)"
EOT
}
variable "boot_disk_size" {
type = string
default = "20Gi"
description = "Boot disk size in k8s quantity format(https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/quantity/)."
}
variable "boot_loader_type" {
type = string
default = ""
description = "The initial machine booting options when powering on before loading the kernel. The supported boot options are uefi or bios."
}
variable "enable_secure_boot" {
type = bool
default = true
description = "Whether to assist blocking modified or malicious code from loading. Only work with UEFI bootloader"
}
variable "storage_class" {
type = string
default = "local-shared"
description = "The name of storage class used to provision the disks"
}
variable "extra_disks" {
type = list(object({
name = string
readonly = optional(bool, false)
auto_delete = optional(bool, false)
}))
default = []
description = <<EOT
A list of existing disks that will be used by the VM.
name : "Name of the VM disk in the same namespace"
readonly : "If the VM disk is readonly."
auto_delete : "If to delete the VM disk when the VM is deleted."
EOT
}
# Compute Inputs
variable "vm_type_name" {
type = string
default = ""
description = "Name of the exsiting virtual machine type"
}
variable "vcpus" {
type = number
default = 1
description = "Number of VCPUs"
}
variable "memory" {
type = string
default = "4Gi"
description = "Memory capacity in k8s quantity format(https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/quantity/)."
}
variable "is_guaranteed" {
type = bool
default = false
description = "If the resources of the VM are in the guaranteed tier"
}
variable "gpu" {
type = object({
model = string
quantity = number
})
default = null
description = <<EOT
model : "The GPU model the VM want to reserve."
quantity : "The number of GPU card for the specific GPU model the VM want to reserve."
EOT
}
variable "dedicated_cpu" {
type = bool
default = false
description = "If the VM should be allocated dedicated host CPU cores and each VM CPU core is pinned to each allocated host CPU core."
}
variable "isolated_emulator_thread" {
type = bool
default = false
description = "If one more dedicated host CPU core should be allocated to the VM for the QEMU emulator thread."
}
variable "hugepage_size" {
type = string
default = ""
description = "Use the huge page instead for the VM memory config. Valid huge pages are 2Mi or 1Gi."
}
variable "numa_guest_mapping_passthrough" {
type = bool
default = false
description = "It creates an efficient guest topology based on container NUMA topology"
}
# Networking Inputs
variable "extra_interfaces" {
type = list(object({
name = string
network = string
ips = list(string)
}))
default = []
description = <<EOT
A list of existing disks that will be used by the VM.
name : "Name of the network interface in the VM."
network : "Name of the Anthos network object."
ips : "A list of IP addresses from the network to be allocated to the VM."
EOT
}
# Status check
variable "wait_fields" {
type = map(string)
default = {
"status.state" = "Running"
}
description = "A map of fields and a corresponding regular expression with a pattern to wait for. The provider will wait until the field matches the regular expression. Use `*` for any value."
}
variable "wait_conditions" {
type = list(object({
type = string
status = string
}))
default = []
description = "A list of conditions to wait for."
}
variable "create_timeout" {
type = string
default = "10m"
description = "Timeout for the disk creation."
}
variable "update_timeout" {
type = string
default = "10m"
description = "Timeout for the disk udpate."
}
variable "delete_timeout" {
type = string
default = "1m"
description = "Timeout for the disk deletion."
}