VMware Cloud Community
carl1
Expert
Expert
Jump to solution

How to optionally add disks

I need to add up to 4 disks of different sizes.  I tried setting the count to ${input.optionalDisk1Size == 0? 0 : 1} but that stops me from adding any other disks to the blueprint.  I can't seem to figure out how to add UP to 4 disks where the sizes vary.  It seems that I need 4 separate disks on the blueprint that may or may not be provisioned.

Any suggestions gratefully accepted.

Carl L.

Reply
0 Kudos
1 Solution

Accepted Solutions
rkhoo
VMware Employee
VMware Employee
Jump to solution

resources:

  #Additional disk 1

  Cloud_vSphere_Disk_1:

    type: Cloud.vSphere.Disk

    properties:

      type: HDD

      capacityGb: '${input.additional-disk-size}'

      count: '${input.number-of-additional-disks > 0 ? 1 : 0}'

      constraints:

        - tag: VSAN

  #Additional disk 2

  Cloud_vSphere_Disk_2:

    type: Cloud.vSphere.Disk

    properties:

      type: HDD

      capacityGb: '${input.additional-disk-size-2}'

      count: '${input.number-of-additional-disks > 1 ? 1 : 0}'

      constraints:

        - tag: VSAN

  Cloud_vSphere_Machine_1:

    type: Cloud.vSphere.Machine

    properties:

      resourceGroupName: vRA-Deployment/vra-machines

      image: Windows-Server-2016-2

      flavor: Medium-Size

      storage:

        constraints:

          - tag: VSAN

      attachedDisks: '${map_to_object(resource.Cloud_vSphere_Disk_1[*].id + resource.Cloud_vSphere_Disk_2[*].id, "source")}'

Here you go, knowing that you can add up to 4 disks of various sizes is not a problem. Use custom form for inputs customization.

*Note - My example only shows up to 2 additional disks

View solution in original post

Reply
0 Kudos
3 Replies
carl1
Expert
Expert
Jump to solution

I should have also said:  vRA 8.1

Reply
0 Kudos
rkhoo
VMware Employee
VMware Employee
Jump to solution

resources:

  #Additional disk 1

  Cloud_vSphere_Disk_1:

    type: Cloud.vSphere.Disk

    properties:

      type: HDD

      capacityGb: '${input.additional-disk-size}'

      count: '${input.number-of-additional-disks > 0 ? 1 : 0}'

      constraints:

        - tag: VSAN

  #Additional disk 2

  Cloud_vSphere_Disk_2:

    type: Cloud.vSphere.Disk

    properties:

      type: HDD

      capacityGb: '${input.additional-disk-size-2}'

      count: '${input.number-of-additional-disks > 1 ? 1 : 0}'

      constraints:

        - tag: VSAN

  Cloud_vSphere_Machine_1:

    type: Cloud.vSphere.Machine

    properties:

      resourceGroupName: vRA-Deployment/vra-machines

      image: Windows-Server-2016-2

      flavor: Medium-Size

      storage:

        constraints:

          - tag: VSAN

      attachedDisks: '${map_to_object(resource.Cloud_vSphere_Disk_1[*].id + resource.Cloud_vSphere_Disk_2[*].id, "source")}'

Here you go, knowing that you can add up to 4 disks of various sizes is not a problem. Use custom form for inputs customization.

*Note - My example only shows up to 2 additional disks

Reply
0 Kudos
carl1
Expert
Expert
Jump to solution

I saw some references to map_to_object in some other discussions.  Thanks so much!

Carl L.

Reply
0 Kudos