diff --git a/main.tf b/main.tf index 88857d3..daa5e28 100644 --- a/main.tf +++ b/main.tf @@ -68,6 +68,7 @@ resource "vsphere_virtual_machine" "Linux" { extra_config = var.extra_config firmware = var.firmware enable_disk_uuid = var.enable_disk_uuid + storage_policy_id = var.storage_policy_id datastore_cluster_id = var.datastore_cluster != "" ? data.vsphere_datastore_cluster.datastore_cluster[0].id : null datastore_id = var.datastore != "" ? data.vsphere_datastore.datastore[0].id : null diff --git a/tests/smoke/.terraform.lock.hcl b/tests/smoke/.terraform.lock.hcl new file mode 100755 index 0000000..276c930 --- /dev/null +++ b/tests/smoke/.terraform.lock.hcl @@ -0,0 +1,19 @@ +# This file is maintained automatically by "terraform init". +# Manual edits may be lost in future updates. + +provider "registry.terraform.io/hashicorp/vsphere" { + version = "1.24.2" + hashes = [ + "h1:BEf8p0h+NYK0hu4dG8NloZtNaSw5nbMKsqwIZWdsIPk=", + "zh:01d8e13dac110466f946da1f14294f64b747f1fa6f2d107f7bc0f8db40624497", + "zh:06670e7baa2c2083afbe01b617aa72bcd2950830ecb66f01e743e361105e7b47", + "zh:17220222bdeeeb7575a51ebd556377e9f2157258eec945710e95ec1a597f8ec7", + "zh:2dfd808800c21a483e7401254d6dd817ec3f7d323525cd7a6d3919c81e30e686", + "zh:671befb1f724ffbc68c117d06619989eb4b62246896ad168384540d1acc7a0b6", + "zh:7d29d02d1c2f82a1c71e38aaa9daa23d4cccfc5d00c0c9ea1e2c36d98343e855", + "zh:98a8acafe6e38f7ad214b53826b2a9dc1f036cfb3833ba67c517eae2e4ea56c0", + "zh:a74fc725844da35ab73105e62b97efe717fb5c5f21554ee656d434e9803f20ad", + "zh:a7ab1a04902254e63dc2dc489e69343c2a53999e987114c932259884594da1ec", + "zh:df0beaef2d925771724cbf19747787f618c595c0712dc210b5581041691310e6", + ] +} diff --git a/tests/smoke/README.md b/tests/smoke/README.md index d246174..b4883b1 100644 --- a/tests/smoke/README.md +++ b/tests/smoke/README.md @@ -23,7 +23,7 @@ vm = { vmgateway = "10.13.13.1" dns_servers = ["1.1.1.1"] network = { - "DEEDC-ECOM-INT-VLAN189" = ["10.13.13.2"], + "VM Networks" = ["10.13.13.2"], } } } diff --git a/tests/smoke/main.tf b/tests/smoke/main.tf index c2517af..ae072bd 100644 --- a/tests/smoke/main.tf +++ b/tests/smoke/main.tf @@ -1,32 +1,32 @@ variable "vm" { type = map(object({ - vmname = string - vmtemp = string - annotation = string - dc = string - vmrp = string - vmfolder = string - datastore_cluster = string - is_windows_image = bool - instances = number - network = map(list(string)) - vmgateway = string - dns_servers = list(string) + vmname = string + vmtemp = string + annotation = string + dc = string + vmrp = string + vmfolder = string + datastore = string + is_windows_image = bool + instances = number + network = map(list(string)) + vmgateway = string + dns_servers = list(string) })) } module "example-server-basic" { - source = "../../" - for_each = var.vm - vmtemp = each.value.vmtemp - annotation = each.value.annotation - is_windows_image = each.value.is_windows_image - instances = each.value.instances - vmname = each.value.vmname - vmrp = each.value.vmrp - vmfolder = each.value.vmfolder - network = each.value.network - vmgateway = each.value.vmgateway - dc = each.value.dc - datastore_cluster = each.value.datastore_cluster #Either + source = "../../" + for_each = var.vm + vmtemp = each.value.vmtemp + annotation = each.value.annotation + is_windows_image = each.value.is_windows_image + instances = each.value.instances + vmname = each.value.vmname + vmrp = each.value.vmrp + vmfolder = each.value.vmfolder + network = each.value.network + vmgateway = each.value.vmgateway + dc = each.value.dc + datastore = each.value.datastore #Either } diff --git a/variables.tf b/variables.tf index 9ad1fb9..ace63a8 100644 --- a/variables.tf +++ b/variables.tf @@ -7,13 +7,13 @@ variable "network" { variable "network_type" { description = "Define network type for each network interface." - type = list + type = list(any) default = null } variable "ipv4submask" { description = "ipv4 Subnet mask." - type = list + type = list(any) default = ["24"] } @@ -36,13 +36,13 @@ variable "data_disk" { variable "disk_label" { description = "Storage data disk labels." - type = list + type = list(any) default = [] } variable "disk_size_gb" { description = "List of disk sizes to override template disk size." - type = list + type = list(any) default = null } @@ -79,6 +79,12 @@ variable "enable_disk_uuid" { type = bool default = null } + +variable "storage_policy_id" { + description = "(Optional) The UUID of the storage policy to assign to VM home directory." + default = null +} + ########################################### variable "vmname" { description = "The name of the virtual machine used to deploy the vms." @@ -146,25 +152,25 @@ variable "vmdns" { #Global Customization Variables variable "tags" { description = "The names of any tags to attach to this resource. They must already exist." - type = map + type = map(any) default = null } variable "tag_ids" { description = "The ids of any tags to attach to this resource. They must already exist." - type = list + type = list(any) default = null } variable "custom_attributes" { description = "Map of custom attribute ids to attribute value strings to set for virtual machine." - type = map + type = map(any) default = null } variable "extra_config" { description = "Extra configuration data for this virtual machine. Can be used to supply advanced parameters not normally in configuration, such as instance metadata.'disk.enableUUID', 'True'." - type = map + type = map(any) default = null }