Skip to content

Commit 93e75fc

Browse files
Update variable types
1 parent cb8acdd commit 93e75fc

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ locals {
6262

6363
// Cloning a Linux VM from a given template. Note: This is the default option!!
6464
resource "vsphere_virtual_machine" "Linux" {
65-
count = var.is_windows_image != "true" ? var.instances : 0
65+
count = var.is_windows_image ? 0 : var.instances
6666
depends_on = [var.vm_depends_on]
6767
name = "%{if var.vmnameliteral != ""}${var.vmnameliteral}%{else}${var.vmname}${count.index + 1}${var.vmnamesuffix}%{endif}"
6868

@@ -158,7 +158,7 @@ resource "vsphere_virtual_machine" "Linux" {
158158
}
159159

160160
resource "vsphere_virtual_machine" "Windows" {
161-
count = var.is_windows_image == "true" ? var.instances : 0
161+
count = var.is_windows_image ? var.instances : 0
162162
depends_on = [var.vm_depends_on]
163163
name = "%{if var.vmnameliteral != ""}${var.vmnameliteral}%{else}${var.vmname}${count.index + 1}${var.vmnamesuffix}%{endif}"
164164

variables.tf

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,16 +149,19 @@ variable "num_cores_per_socket" {
149149

150150
variable "cpu_hot_add_enabled" {
151151
description = "Allow CPUs to be added to this virtual machine while it is running."
152+
type = bool
152153
default = null
153154
}
154155

155156
variable "cpu_hot_remove_enabled" {
156157
description = "Allow CPUs to be removed to this virtual machine while it is running."
158+
type = bool
157159
default = null
158160
}
159161

160162
variable "memory_hot_add_enabled" {
161163
description = "Allow memory to be added to this virtual machine while it is running."
164+
type = bool
162165
default = null
163166
}
164167

@@ -247,6 +250,7 @@ variable "eagerly_scrub" {
247250

248251
variable "enable_disk_uuid" {
249252
description = "Expose the UUIDs of attached virtual disks to the virtual machine, allowing access to them in the guest."
253+
type = bool
250254
default = null
251255
}
252256

@@ -259,6 +263,7 @@ variable "network_type" {
259263
#Linux Customization Variables
260264
variable "hw_clock_utc" {
261265
description = "Tells the operating system that the hardware clock is set to UTC"
266+
type = bool
262267
default = true
263268
}
264269

@@ -271,6 +276,7 @@ variable "vmdomain" {
271276
#Windows Customization Variables
272277
variable "is_windows_image" {
273278
description = "Boolean flag to notify when the custom image is windows based."
279+
type = bool
274280
default = false
275281
}
276282

@@ -306,6 +312,7 @@ variable "orgname" {
306312

307313
variable "auto_logon" {
308314
description = " Specifies whether or not the VM automatically logs on as Administrator. Default: false"
315+
type = bool
309316
default = null
310317
}
311318

@@ -337,20 +344,20 @@ variable "full_name" {
337344

338345
variable "wait_for_guest_net_routable" {
339346
description = "Controls whether or not the guest network waiter waits for a routable address. When false, the waiter does not wait for a default gateway, nor are IP addresses checked against any discovered default gateways as part of its success criteria. This property is ignored if the wait_for_guest_ip_timeout waiter is used."
340-
default = true
341347
type = bool
348+
default = true
342349
}
343350

344351
variable "wait_for_guest_ip_timeout" {
345352
description = "The amount of time, in minutes, to wait for an available guest IP address on this virtual machine. This should only be used if your version of VMware Tools does not allow the wait_for_guest_net_timeout waiter to be used. A value less than 1 disables the waiter."
346-
default = 0
347353
type = number
354+
default = 0
348355
}
349356

350357
variable "wait_for_guest_net_timeout" {
351358
description = "The amount of time, in minutes, to wait for an available IP address on this virtual machine's NICs. Older versions of VMware Tools do not populate this property. In those cases, this waiter can be disabled and the wait_for_guest_ip_timeout waiter can be used instead. A value less than 1 disables the waiter."
352-
default = 5
353359
type = number
360+
default = 5
354361
}
355362

356363
variable "vm_depends_on" {

0 commit comments

Comments
 (0)