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

Multiple disks: unordered lists #129

Closed osd42 closed 2 years ago

osd42 commented 2 years ago

Hello, thank your for this powerful module ! So much more than the provider !

I have multiples issues with disk customization.

Is it possible to fix the disk module so we can declare 15 disks per controler (if naming convention changes to "disk00, disk01, disk02" and so the ability to have a second disk00 on controler 1 so we could use all controlers disks slots ? If not I suggest to warn it in documentation : the 10th additionnal disk can cause dramatical incidents on OS reboot. Or am I using the feature badly ?

Thank you !

=========

example 1 : 17 disks

  vm_data_disk = {
    # bin log disk
    disk1 = {
      size_gb                   = 420,
      thin_provisioned          = false,
      data_disk_scsi_controller = 0,
      eagerly_scrub             = true,
    }
    # /srv DATA DISKS
    disk2 = {
      size_gb                   = 2,
      thin_provisioned          = false,
      data_disk_scsi_controller = 0,
      eagerly_scrub             = true,
    }
    disk3 = {
      size_gb                   = 3,
      thin_provisioned          = false,
      data_disk_scsi_controller = 0,
      eagerly_scrub             = true,
    }
    disk4 = {
      size_gb                   = 4,
      thin_provisioned          = false,
      data_disk_scsi_controller = 0,
      eagerly_scrub             = true,
    }
    disk5 = {
      size_gb                   = 5,
      thin_provisioned          = false,
      data_disk_scsi_controller = 0,
      eagerly_scrub             = true,
    }
    disk6 = {
      size_gb                   = 6,
      thin_provisioned          = false,
      data_disk_scsi_controller = 0,
      eagerly_scrub             = true,
    }
    disk7 = {
      size_gb                   = 7,
      thin_provisioned          = false,
      data_disk_scsi_controller = 0,
      eagerly_scrub             = true,
    }
    disk8 = {
      size_gb                   = 8,
      thin_provisioned          = false,
      data_disk_scsi_controller = 0,
      eagerly_scrub             = true,
    }
    disk9 = {
      size_gb                   = 9,
      thin_provisioned          = false,
      data_disk_scsi_controller = 0,
      eagerly_scrub             = true,
    }
    disk10 = {
      size_gb                   = 10,
      thin_provisioned          = false,
      data_disk_scsi_controller = 0,
      eagerly_scrub             = true,
    }
    disk11 = {
      size_gb                   = 11,
      thin_provisioned          = false,
      data_disk_scsi_controller = 0,
      eagerly_scrub             = true,
    }
    disk12 = {
      size_gb                   = 12,
      thin_provisioned          = false,
      data_disk_scsi_controller = 0,
      eagerly_scrub             = true,
    }
    disk13 = {
      size_gb                   = 13,
      thin_provisioned          = false,
      data_disk_scsi_controller = 0,
      eagerly_scrub             = true,
    }
    disk14 = {
      size_gb                   = 14,
      thin_provisioned          = false,
      data_disk_scsi_controller = 1,
      eagerly_scrub             = true,
    }
    disk15 = {
      size_gb                   = 15,
      thin_provisioned          = false,
      data_disk_scsi_controller = 1,
      eagerly_scrub             = true,
    }
    disk16 = {
      size_gb                   = 16,
      thin_provisioned          = false,
      data_disk_scsi_controller = 1,
      eagerly_scrub             = true,
    }
  }

result :

17 disks in vm but unordered and taking random device numbers on controler 1.

test 2 : Only 9 additional disks (my advice ATM)

  vm_data_disk = {
    # binlog disk
    disk1 = {
      size_gb                   = 420,
      thin_provisioned          = false,
      data_disk_scsi_controller = 0,
      eagerly_scrub             = true,
    }
    # /srv DATA DISKS
    disk2 = {
      size_gb                   = 2,
      thin_provisioned          = false,
      data_disk_scsi_controller = 0,
      eagerly_scrub             = true,
    }
    disk3 = {
      size_gb                   = 3,
      thin_provisioned          = false,
      data_disk_scsi_controller = 0,
      eagerly_scrub             = true,
    }
    disk4 = {
      size_gb                   = 4,
      thin_provisioned          = false,
      data_disk_scsi_controller = 0,
      eagerly_scrub             = true,
    }
    disk5 = {
      size_gb                   = 5,
      thin_provisioned          = false,
      data_disk_scsi_controller = 0,
      eagerly_scrub             = true,
    }
    disk6 = {
      size_gb                   = 6,
      thin_provisioned          = false,
      data_disk_scsi_controller = 0,
      eagerly_scrub             = true,
    }
    disk7 = {
      size_gb                   = 7,
      thin_provisioned          = false,
      data_disk_scsi_controller = 0,
      eagerly_scrub             = true,
    }
    disk8 = {
      size_gb                   = 8,
      thin_provisioned          = false,
      data_disk_scsi_controller = 0,
      eagerly_scrub             = true,
    }
    disk9 = {
      size_gb                   = 9,
      thin_provisioned          = false,
      data_disk_scsi_controller = 0,
      eagerly_scrub             = true,
    }
  }

result OK : disks are all ordered on controler 0 on vmware side :

clone disk : O:O disk1 : 0:1 size 420 ... disk9: 0:9 size 9

We know the order is OK due to sizing on each disk

test 3 : 10th (and more) disk order (same disk configuration but with disk10 11 12) :

result KO :

clone disque: 0:0 disk1 : 0:1 size 420 disk2 : 0:2 size 2 disk10 : 0:3 size 10 disk11 : 0:4 size 11 disk12 : 0:5 size 12 disk13: 0:7 size 13 disk14 : 0:8 size 14 disk3 : 0:9 size 3 disk4: 0:10 size 4 disk5: 0:11 size 5 disk6: 0:12 size 6 disk7: 0:13 size 7 disk8: 0:14 size 8 disk9: 0:15 size 9

This is due to alphabetical order. The module allows to add disks on the fly or to enlarge the size. If you add a "disk10+" you will have very big issues on vm reboot.

Best regards

stale[bot] commented 2 years 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.

stale[bot] commented 2 years ago

enable