CompositionalIT / farmer

Repeatable Azure deployments with ARM templates - made easy!
https://compositionalit.github.io/farmer
MIT License
523 stars 157 forks source link

Add support for creating and attaching VM disks #1013

Closed ninjarobot closed 1 year ago

ninjarobot commented 1 year ago

This PR closes #904

The changes in this PR are as follows:

I have read the contributing guidelines and have completed the following:

If I haven't completed any of the tasks above, I include the reasons why here:

Below is a minimal example configuration that includes the new features, which can be used to deploy to Azure:

let disk0 =
    disk {
        name "disk-0"
        sku Vm.DiskType.Premium_LRS
        os_type Linux
        create_empty 1024<Gb>
    }

let disk1 =
    disk {
        name "disk-1"
        sku Vm.DiskType.Standard_LRS
        os_type Linux
        import
            (System.Uri
                "https://mystorageaccount.blob.core.windows.net/vhds/MyVirtualHardDisk.vhd")
            (Arm.Storage.storageAccounts.resourceId "mystorageaccount")
    }

let vmWithAttachedDisks =
    vm {
        name "vm-with-attached-disks"
        vm_size Standard_B1ms
        operating_system UbuntuServer_2204LTS
        username "azureuser"
        attach_data_disk disk0
        attach_data_disk disk1
    }

let deployment =
    arm {
        add_resources
            [
                disk0
                disk1
                vmWithAttachedDisks
            ]
    }
ninjarobot commented 1 year ago

@isaacabraham could you please review this - it enables creating and attaching VM disks as requested in #904.