Badgerati / Fogg

PowerShell tool to aide and simplify the creation, deployment and provisioning of infrastructure in Azure
MIT License
7 stars 2 forks source link

Ability to have appending VM creation, rather than just fixed #44

Closed Badgerati closed 7 years ago

Badgerati commented 7 years ago

When we create a template for a VM with a count of 1, it will ALWAYS create just 1 VM. If that VM exists, it updates the existing one and leaves it at that. ie, there is always only 1 VM.

It would be cool to have an "append": true property on a VM template that created and additional X VMs where X is the count. So a "count": 1 after 3 runs you would have 3 VMs not just 1.

This would be useful for regression/test environments where you can constantly spin up new VMs on each commit or deploy of a release - deleting the VMs when testing is done.

Of course, this dynamic creation will only apply to VMs, the RG, NICs, NSGs and VNETs will all still be treated like normal.

Also, when naming the VMs, the fixed way just appends the VM index the name like "test-vm1" and "test-vm2". Here, that won't work, so we'll need to get the number of VMs with the base "test-vm" name first to work out the appended value.

A real bonus would be to make it figure out in-between values. So if we create vm1 then vm2, then delete vm1; instead of creating a conflict vm2 or even a vm3, create a new vm1. Then, if 1 and 2 are still up, create a 3 and so-on-forth.

Badgerati commented 7 years ago

It's a little intelligent when appending new VMs with their names. It will retrieve currently existing VMs of that type, get the index value of the last deployed one and continue the count from that value.