-
Notifications
You must be signed in to change notification settings - Fork 131
/
variables.tf
379 lines (331 loc) · 11.6 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
# Copyright 2023 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 "project_id" { # tflint-ignore: terraform_unused_declarations
type = string
description = "Project ID to create resources in."
}
variable "region" {
type = string
description = "Region where the instances should be created."
default = null
}
variable "zone" {
type = string
description = <<-EOD
Zone where the instances should be created. If not specified, instances will be
spread across available zones in the region.
EOD
default = null
}
variable "name_prefix" {
type = string
description = <<-EOD
Unique name prefix for login nodes. Automatically populated by the module id if not set.
If setting manually, ensure a unique value across all login groups.
EOD
}
variable "num_instances" {
type = number
description = "Number of instances to create. This value is ignored if static_ips is provided."
default = 1
}
variable "disk_type" {
type = string
description = "Boot disk type, can be either hyperdisk-balanced, pd-ssd, pd-standard, pd-balanced, or pd-extreme."
default = "pd-ssd"
}
variable "disk_size_gb" {
type = number
description = "Boot disk size in GB."
default = 50
}
variable "disk_auto_delete" {
type = bool
description = "Whether or not the boot disk should be auto-deleted."
default = true
}
variable "disk_labels" {
description = "Labels specific to the boot disk. These will be merged with var.labels."
type = map(string)
default = {}
}
variable "additional_disks" {
type = list(object({
disk_name = string
device_name = string
disk_type = string
disk_size_gb = number
disk_labels = map(string)
auto_delete = bool
boot = bool
}))
description = "List of maps of disks."
default = []
}
variable "additional_networks" {
description = "Additional network interface details for GCE, if any."
default = []
type = list(object({
access_config = optional(list(object({
nat_ip = string
network_tier = string
})), [])
alias_ip_range = optional(list(object({
ip_cidr_range = string
subnetwork_range_name = string
})), [])
ipv6_access_config = optional(list(object({
network_tier = string
})), [])
network = optional(string)
network_ip = optional(string, "")
nic_type = optional(string)
queue_count = optional(number)
stack_type = optional(string)
subnetwork = optional(string)
subnetwork_project = optional(string)
}))
nullable = false
}
variable "enable_smt" {
type = bool
description = "Enables Simultaneous Multi-Threading (SMT) on instance."
default = false
}
variable "disable_smt" { # tflint-ignore: terraform_unused_declarations
description = "DEPRECATED: Use `enable_smt` instead."
type = bool
default = null
validation {
condition = var.disable_smt == null
error_message = "DEPRECATED: Use `enable_smt` instead."
}
}
variable "static_ips" {
type = list(string)
description = "List of static IPs for VM instances."
default = []
}
variable "bandwidth_tier" {
description = <<EOT
Configures the network interface card and the maximum egress bandwidth for VMs.
- Setting `platform_default` respects the Google Cloud Platform API default values for networking.
- Setting `virtio_enabled` explicitly selects the VirtioNet network adapter.
- Setting `gvnic_enabled` selects the gVNIC network adapter (without Tier 1 high bandwidth).
- Setting `tier_1_enabled` selects both the gVNIC adapter and Tier 1 high bandwidth networking.
- Note: both gVNIC and Tier 1 networking require a VM image with gVNIC support as well as specific VM families and shapes.
- See [official docs](https://cloud.google.com/compute/docs/networking/configure-vm-with-high-bandwidth-configuration) for more details.
EOT
type = string
default = "platform_default"
validation {
condition = contains(["platform_default", "virtio_enabled", "gvnic_enabled", "tier_1_enabled"], var.bandwidth_tier)
error_message = "Allowed values for bandwidth_tier are 'platform_default', 'virtio_enabled', 'gvnic_enabled', or 'tier_1_enabled'."
}
}
variable "can_ip_forward" {
type = bool
description = "Enable IP forwarding, for NAT instances for example."
default = false
}
variable "enable_login_public_ips" {
description = "If set to true. The login node will have a random public IP assigned to it."
type = bool
default = false
}
variable "disable_login_public_ips" { # tflint-ignore: terraform_unused_declarations
description = "DEPRECATED: Use `enable_login_public_ips` instead."
type = bool
default = null
validation {
condition = var.disable_login_public_ips == null
error_message = "DEPRECATED: Use `enable_login_public_ips` instead."
}
}
variable "enable_oslogin" {
type = bool
description = <<-EOD
Enables Google Cloud os-login for user login and authentication for VMs.
See https://cloud.google.com/compute/docs/oslogin
EOD
default = true
}
variable "enable_confidential_vm" {
type = bool
description = "Enable the Confidential VM configuration. Note: the instance image must support option."
default = false
}
variable "enable_shielded_vm" {
type = bool
description = "Enable the Shielded VM configuration. Note: the instance image must support option."
default = false
}
variable "shielded_instance_config" {
type = object({
enable_integrity_monitoring = bool
enable_secure_boot = bool
enable_vtpm = bool
})
description = <<EOD
Shielded VM configuration for the instance. Note: not used unless
enable_shielded_vm is 'true'.
enable_integrity_monitoring : Compare the most recent boot measurements to the
integrity policy baseline and return a pair of pass/fail results depending on
whether they match or not.
enable_secure_boot : Verify the digital signature of all boot components, and
halt the boot process if signature verification fails.
enable_vtpm : Use a virtualized trusted platform module, which is a
specialized computer chip you can use to encrypt objects like keys and
certificates.
EOD
default = {
enable_integrity_monitoring = true
enable_secure_boot = true
enable_vtpm = true
}
}
variable "guest_accelerator" {
description = "List of the type and count of accelerator cards attached to the instance."
type = list(object({
type = string,
count = number
}))
default = []
nullable = false
validation {
condition = length(var.guest_accelerator) <= 1
error_message = "The Slurm modules supports 0 or 1 models of accelerator card on each node."
}
}
variable "labels" {
type = map(string)
description = "Labels, provided as a map."
default = {}
}
variable "machine_type" {
type = string
description = "Machine type to create."
default = "c2-standard-4"
}
variable "metadata" {
type = map(string)
description = "Metadata, provided as a map."
default = {}
}
variable "min_cpu_platform" {
type = string
description = <<EOD
Specifies a minimum CPU platform. Applicable values are the friendly names of
CPU platforms, such as Intel Haswell or Intel Skylake. See the complete list:
https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform
EOD
default = null
}
variable "preemptible" {
type = bool
description = "Allow the instance to be preempted."
default = false
}
variable "on_host_maintenance" {
type = string
description = "Instance availability Policy."
default = "MIGRATE"
}
variable "service_account_email" {
description = "Service account e-mail address to attach to the login instances."
type = string
default = null
}
variable "service_account_scopes" {
description = "Scopes to attach to the login instances."
type = set(string)
default = ["https://www.googleapis.com/auth/cloud-platform"]
}
variable "service_account" { # tflint-ignore: terraform_unused_declarations
description = "DEPRECATED: Use `service_account_email` and `service_account_scopes` instead."
type = object({
email = string
scopes = set(string)
})
default = null
validation {
condition = var.service_account == null
error_message = "DEPRECATED: Use `service_account_email` and `service_account_scopes` instead."
}
}
variable "instance_template" { # tflint-ignore: terraform_unused_declarations
description = "DEPRECATED: Instance template can not be specified for login nodes."
type = string
default = null
validation {
condition = var.instance_template == null
error_message = "DEPRECATED: Instance template can not be specified for login nodes."
}
}
variable "instance_image" {
description = <<-EOD
Defines the image that will be used in the Slurm controller VM instance.
Expected Fields:
name: The name of the image. Mutually exclusive with family.
family: The image family to use. Mutually exclusive with name.
project: The project where the image is hosted.
For more information on creating custom images that comply with Slurm on GCP
see the "Slurm on GCP Custom Images" section in docs/vm-images.md.
EOD
type = map(string)
default = {
family = "slurm-gcp-6-6-hpc-rocky-linux-8"
project = "schedmd-slurm-public"
}
validation {
condition = can(coalesce(var.instance_image.project))
error_message = "In var.instance_image, the \"project\" field must be a string set to the Cloud project ID."
}
validation {
condition = can(coalesce(var.instance_image.name)) != can(coalesce(var.instance_image.family))
error_message = "In var.instance_image, exactly one of \"family\" or \"name\" fields must be set to desired image family or name."
}
}
variable "instance_image_custom" {
description = <<-EOD
A flag that designates that the user is aware that they are requesting
to use a custom and potentially incompatible image for this Slurm on
GCP module.
If the field is set to false, only the compatible families and project
names will be accepted. The deployment will fail with any other image
family or name. If set to true, no checks will be done.
See: https://goo.gle/hpc-slurm-images
EOD
type = bool
default = false
}
variable "allow_automatic_updates" {
description = <<-EOT
If false, disables automatic system package updates on the created instances. This feature is
only available on supported images (or images derived from them). For more details, see
https://cloud.google.com/compute/docs/instances/create-hpc-vm#disable_automatic_updates
EOT
type = bool
default = true
nullable = false
}
variable "tags" {
type = list(string)
description = "Network tag list."
default = []
}
variable "subnetwork_self_link" {
type = string
description = "Subnet to deploy to."
}