I was helping someone with a small challenge in their Aria Automation Cloud template and had to dig to find the solution. They didn’t find any examples through a search, and neither did I – so I thought I would share. The goal was to do basic math (addition) in the YAML of the Cloud Template.
The use case was a cloud template adding multiple disks in a virtual machine. They had a need to control the name of the VMDK differently than was specified in the Project Custom Naming template. They were using an array of disks in the Cloud Template and the index of that array to make the VMDK name unique (The second disk for the vm should be called mytestvm_disk2.vmdk).
As most arrays in computing are, the index was zero-based (the second disk was called mytestvm_disk1.vmdk). While this would provide a unique name for each disk, the preference was to start with 1 to make it easier on the large number of admins who manage workloads in the environment. They tried various ways of formatting the YAML to get the addition correct; but could not find a way that worked as expected.
I cannot share the code that this customer wrote; but have worked up a simple example to illustrate. The use case this code sample represents is not something you would normally do; but will serve to highlight the syntax to allow some basic math in an Aria Automation Cloud Template.