I have created a module that creates VM's using this provider. Most values are common across all VM's so those are kept within the module. Properties that change between instances are passed in as variables. All works well, except disks.
I am passing in a map variable that contains zero or more disk parameters, the key is the disk name, then we have size and type values.
But I am not sure how I can use this map to create the disk resources and then virtual disks in the esxi_guest resource.
As you would expect I do not want any extra disks if the map is null or empty, and one disk for each map object if any exist.
Can someone please help with suggestions on how I might achieve this.
I have created a module that creates VM's using this provider. Most values are common across all VM's so those are kept within the module. Properties that change between instances are passed in as variables. All works well, except disks.
I am passing in a map variable that contains zero or more disk parameters, the key is the disk name, then we have size and type values.
But I am not sure how I can use this map to create the disk resources and then virtual disks in the esxi_guest resource.
As you would expect I do not want any extra disks if the map is null or empty, and one disk for each map object if any exist.
Can someone please help with suggestions on how I might achieve this.
A copy of my main.tf from the module is below.