diff --git a/examples/azure-vm-simple-linux/README.md b/examples/azure-vm-simple-linux-managed-disk/README.md similarity index 100% rename from examples/azure-vm-simple-linux/README.md rename to examples/azure-vm-simple-linux-managed-disk/README.md diff --git a/examples/azure-vm-simple-linux/after_deploy.sh b/examples/azure-vm-simple-linux-managed-disk/after_deploy.sh similarity index 100% rename from examples/azure-vm-simple-linux/after_deploy.sh rename to examples/azure-vm-simple-linux-managed-disk/after_deploy.sh diff --git a/examples/azure-vm-simple-linux-managed-disk/deploy.mac.sh b/examples/azure-vm-simple-linux-managed-disk/deploy.mac.sh new file mode 100755 index 0000000000..ab076afdbc --- /dev/null +++ b/examples/azure-vm-simple-linux-managed-disk/deploy.mac.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +set -o errexit -o nounset + +# generate a unique string for CI deployment +export KEY=$(cat /dev/urandom | env LC_CTYPE=C tr -cd 'a-z' | head -c 12) +export PASSWORD=$KEY$(cat /dev/urandom | env LC_CTYPE=C tr -cd 'A-Z' | head -c 2)$(cat /dev/urandom | env LC_CTYPE=C tr -cd '0-9' | head -c 2) + +/bin/sh ./deploy.sh + +### capture vm image +# docker run --rm -it \ +# azuresdk/azure-cli-python \ +# sh -c "az login --service-principal -u $ARM_CLIENT_ID -p $ARM_CLIENT_SECRET --tenant $ARM_TENANT_ID; \ +# az vm deallocate --name rgvm --resource-group permanent; \ +# az vm generalize --name rgvm --resource-group permanent; \ +# az image create --name customImage --source rgvm --resource-group permanent" + +### cleanup +# docker run --rm -it \ +# azuresdk/azure-cli-python \ +# sh -c "az login --service-principal -u $ARM_CLIENT_ID -p $ARM_CLIENT_SECRET --tenant $ARM_TENANT_ID; \ +# az group delete -y -n $KEY" diff --git a/examples/azure-vm-simple-linux/deploy.sh b/examples/azure-vm-simple-linux-managed-disk/deploy.sh similarity index 100% rename from examples/azure-vm-simple-linux/deploy.sh rename to examples/azure-vm-simple-linux-managed-disk/deploy.sh diff --git a/examples/azure-vm-simple-linux/main.tf b/examples/azure-vm-simple-linux-managed-disk/main.tf similarity index 76% rename from examples/azure-vm-simple-linux/main.tf rename to examples/azure-vm-simple-linux-managed-disk/main.tf index cf931d0f9e..e9c0877d5a 100644 --- a/examples/azure-vm-simple-linux/main.tf +++ b/examples/azure-vm-simple-linux-managed-disk/main.tf @@ -52,17 +52,8 @@ resource "azurerm_storage_container" "storc" { container_access_type = "private" } -resource "azurerm_managed_disk" "disk1" { - name = "${var.hostname}-osdisk1" - location = "${var.location}" - resource_group_name = "${azurerm_resource_group.rg.name}" - storage_account_type = "Standard_LRS" - create_option = "Empty" - disk_size_gb = "30" -} - -resource "azurerm_managed_disk" "disk2" { - name = "${var.hostname}-disk2" +resource "azurerm_managed_disk" "datadisk" { + name = "${var.hostname}-datadisk" location = "${var.location}" resource_group_name = "${azurerm_resource_group.rg.name}" storage_account_type = "Standard_LRS" @@ -85,18 +76,19 @@ resource "azurerm_virtual_machine" "vm" { } storage_os_disk { - name = "${var.hostname}-osdisk1" - vhd_uri = "${azurerm_storage_account.stor.primary_blob_endpoint}${azurerm_storage_container.storc.name}/${var.hostname}-osdisk1.vhd" - caching = "ReadWrite" - create_option = "FromImage" + name = "${var.hostname}-osdisk" + managed_disk_type = "Standard_LRS" + caching = "ReadWrite" + create_option = "FromImage" } storage_data_disk { - name = "${var.hostname}-disk2" - vhd_uri = "${azurerm_storage_account.stor.primary_blob_endpoint}${azurerm_storage_container.storc.name}/${var.hostname}-disk2.vhd" - disk_size_gb = "1023" - create_option = "Empty" - lun = 0 + name = "${var.hostname}-datadisk" + managed_disk_id = "${azurerm_managed_disk.datadisk.id}" + managed_disk_type = "Standard_LRS" + disk_size_gb = "1023" + create_option = "Attach" + lun = 0 } os_profile { diff --git a/examples/azure-vm-simple-linux/outputs.tf b/examples/azure-vm-simple-linux-managed-disk/outputs.tf similarity index 100% rename from examples/azure-vm-simple-linux/outputs.tf rename to examples/azure-vm-simple-linux-managed-disk/outputs.tf diff --git a/examples/azure-vm-simple-linux/provider.tf b/examples/azure-vm-simple-linux-managed-disk/provider.tf similarity index 100% rename from examples/azure-vm-simple-linux/provider.tf rename to examples/azure-vm-simple-linux-managed-disk/provider.tf diff --git a/examples/azure-vm-simple-linux/terraform.tfvars b/examples/azure-vm-simple-linux-managed-disk/terraform.tfvars similarity index 100% rename from examples/azure-vm-simple-linux/terraform.tfvars rename to examples/azure-vm-simple-linux-managed-disk/terraform.tfvars diff --git a/examples/azure-vm-simple-linux/variables.tf b/examples/azure-vm-simple-linux-managed-disk/variables.tf similarity index 100% rename from examples/azure-vm-simple-linux/variables.tf rename to examples/azure-vm-simple-linux-managed-disk/variables.tf