I’m trying to create a module to create Azure VMs. I want to have the option of creating more than 1 VM by using the count operator.
The Root modules will be for different server Role types with their specific resource block requirements for disks etc but will all create the base VM via the same VM child module (if possible).
In the root module I want to call the VM child module to create the VM and it’s vnics then in root I create a data disk and then a disk attachment but the disk attachment wants the VM id.
I can add the count operator to the disk attachment but how do I reference the count index from the VMs created in the module? Is this even possible? I thought about using the VM outputs but I don’t believe that can use count so I’m a bit stuck. Can you even reference resource indexes created in child modules?
I did get most configuration going through when creating with a count of 1 by using [*] in the outputs but then when increasing the count to 2 it all obviously didn’t like it.
