Terraform-VMWare-Modules / terraform-vsphere-vm

Terraform vSphere module for provisioning Virtual Machines
https://registry.terraform.io/modules/Terraform-VMWare-Modules/vm/vsphere/
MIT License
169 stars 176 forks source link

Wrong index for disk_size_gb #148

Closed smutel closed 1 year ago

smutel commented 1 year ago

Hello,

The index used to create VMs from clone is not correct. This MR fix this issue.

Thanks.

Arman-Keyoumarsi commented 1 year ago

Hi, Thanks for the commit.

I am not sure there is an issue with the current code. Can you elaborate more ?

Please follow the contribution guideline and attach a passed sanity and smoke test to the PR. Thanks!!

smutel commented 1 year ago

Hello,

For example, if you create two vms with this code (each 10G of disk):

module "example-server-linuxvm" {
  source    = "Terraform-VMWare-Modules/vm/vsphere"
  version   = "X.X.X"
  vmtemp    = "VM Template Name (Should Alrerady exist)"
  instances = 2
  disk_size_gb = [10, 10]
  vmname    = "example-server-linux"
  vmrp      = "esxi/Resources - or name of a resource pool"
  network = {
    "Name of the Port Group in vSphere" = ["10.13.113.2", "10.13.113.3"] # To use DHCP create Empty list ["",""]; You can also use a CIDR annotation;
  }
  vmgateway = "10.13.113.1"
  dc        = "Datacenter"
  datastore = "Data Store name(use datastore_cluster for datastore cluster)"
}

And you change the disk size of the first vm only with:

  disk_size_gb = [40, 10]

terraform wants to change the disk size of the two vms.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Arman-Keyoumarsi commented 1 year ago

Count index wont work. If you have only 1 VM and 2 disk count always return 1 iteration