We are using TF to control Azure and a set of scale sets. With scale sets you are able to define how many VMs you want per set. We now want to add another provider that does not have this concept and I am trying to find the best way to handle this. For example in Azure:
linux_ondemand = {
"set-1" = { instances = 500, instance_size = "Standard_B1ls", image = azurerm_shared_image.1.id, sg = azurerm_network_security_group.1.id},
"set-2" = { instances = 200, instance_size = "Standard_B1ls", image = azurerm_shared_image.2.id, sg = azurerm_network_security_group.2.id},
}
}
resource "azurerm_linux_virtual_machine_scale_set" "linux_ondemand" {
for_each = local.linux_ondemand
name = each.key
instances = each.value.instances
sku = each.value.instance_size
single_placement_group = false
source_image_id = each.value.image
network_interface {
name = "default-nic"
primary = true
network_security_group_id = each.value.sg
}```
This would let us easily spin up a large number of similar VMs. If there was a way to use for_each and count instead this would be easy, so just curious if there are any suggestions on the best way to handle this on other providers. We are trying to make it easy for users to add more sets of instances.