From ebde6db90977a390823f5c08146e8d9216997cbc Mon Sep 17 00:00:00 2001 From: kt Date: Thu, 20 Jun 2019 09:53:51 -0700 Subject: [PATCH] azurestack_virtual_machine_scale_set: add support for managed disks (#93) --- azurestack/resource_arm_virtual_machine.go | 4 +- .../resource_arm_virtual_machine_scale_set.go | 138 ++++++++++++++++-- ...urce_arm_virtual_machine_scale_set_test.go | 100 +++++-------- .../r/virtual_machine_scale_set.html.markdown | 1 + 4 files changed, 170 insertions(+), 73 deletions(-) diff --git a/azurestack/resource_arm_virtual_machine.go b/azurestack/resource_arm_virtual_machine.go index d9f3f034a..20b9e01ad 100644 --- a/azurestack/resource_arm_virtual_machine.go +++ b/azurestack/resource_arm_virtual_machine.go @@ -1002,7 +1002,9 @@ func flattenAzureStackVirtualMachineDataDisk(disks *[]compute.DataDisk, disksInf if disk.DiskSizeGB != nil { l["disk_size_gb"] = *disk.DiskSizeGB } - l["lun"] = *disk.Lun + if v := disk.Lun; v != nil { + l["lun"] = *v + } if v := disk.WriteAcceleratorEnabled; v != nil { l["write_accelerator_enabled"] = *disk.WriteAcceleratorEnabled diff --git a/azurestack/resource_arm_virtual_machine_scale_set.go b/azurestack/resource_arm_virtual_machine_scale_set.go index df903dcab..457209d9a 100644 --- a/azurestack/resource_arm_virtual_machine_scale_set.go +++ b/azurestack/resource_arm_virtual_machine_scale_set.go @@ -37,6 +37,7 @@ func resourceArmVirtualMachineScaleSet() *schema.Resource { "location": locationSchema(), "resource_group_name": resourceGroupNameSchema(), + // Not supported on profile: 2017-03-09 // "zones": zonesSchema(), @@ -396,6 +397,7 @@ func resourceArmVirtualMachineScaleSet() *schema.Resource { }, Set: resourceArmVirtualMachineScaleSetNetworkConfigurationHash, }, + //Not supported on profile: 2017-03-09 // "boot_diagnostics": { // Type: schema.TypeList, @@ -439,6 +441,17 @@ func resourceArmVirtualMachineScaleSet() *schema.Resource { Set: schema.HashString, }, + "managed_disk_type": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ConflictsWith: []string{"storage_profile_os_disk.vhd_containers"}, + ValidateFunc: validation.StringInSlice([]string{ + string(compute.PremiumLRS), + string(compute.StandardLRS), + }, false), + }, + "caching": { Type: schema.TypeString, Optional: true, @@ -486,6 +499,17 @@ func resourceArmVirtualMachineScaleSet() *schema.Resource { Computed: true, ValidateFunc: validateDiskSizeGB, }, + + "managed_disk_type": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ConflictsWith: []string{"storage_profile_os_disk.vhd_containers"}, + ValidateFunc: validation.StringInSlice([]string{ + string(compute.PremiumLRS), + string(compute.StandardLRS), + }, false), + }, }, }, }, @@ -629,13 +653,13 @@ func resourceArmVirtualMachineScaleSetCreate(d *schema.ResourceData, meta interf storageProfile.OsDisk = osDisk // Not supported - // if _, ok := d.GetOk("storage_profile_data_disk"); ok { - // dataDisks, err := expandAzureStackVirtualMachineScaleSetsStorageProfileDataDisk(d) - // if err != nil { - // return err - // } - // storageProfile.DataDisks = &dataDisks - // } + if _, ok := d.GetOk("storage_profile_data_disk"); ok { + dataDisks, err := expandAzureStackVirtualMachineScaleSetsStorageProfileDataDisk(d) + if err != nil { + return err + } + storageProfile.DataDisks = &dataDisks + } if _, ok := d.GetOk("storage_profile_image_reference"); ok { imageRef, err := expandAzureRmVirtualMachineScaleSetStorageProfileImageReference(d) @@ -789,6 +813,13 @@ func resourceArmVirtualMachineScaleSetRead(d *schema.ResourceData, meta interfac if storageProfile := profile.StorageProfile; storageProfile != nil { + if dataDisks := resp.VirtualMachineProfile.StorageProfile.DataDisks; dataDisks != nil { + flattenedDataDisks := flattenAzureStackVirtualMachineScaleSetStorageProfileDataDisk(dataDisks) + if err := d.Set("storage_profile_data_disk", flattenedDataDisks); err != nil { + return fmt.Errorf("[DEBUG] Error setting `storage_profile_data_disk`: %#v", err) + } + } + if imageRef := storageProfile.ImageReference; imageRef != nil { flattenedImageRef := flattenAzureRmVirtualMachineScaleSetStorageProfileImageReference(imageRef) if err := d.Set("storage_profile_image_reference", flattenedImageRef); err != nil { @@ -837,7 +868,7 @@ func resourceArmVirtualMachineScaleSetDelete(d *schema.ResourceData, meta interf return err } - if err = future.WaitForCompletion(ctx, client.Client); err != nil { + if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { return fmt.Errorf("Error Deleting Virtual Machine Scale Set %s (resource group %s) ID: %+v", name, resGroup, err) } @@ -1066,6 +1097,10 @@ func flattenAzureRmVirtualMachineScaleSetStorageProfileOSDisk(profile *compute.V result["vhd_containers"] = schema.NewSet(schema.HashString, containers) } + if profile.ManagedDisk != nil { + result["managed_disk_type"] = string(profile.ManagedDisk.StorageAccountType) + } + result["caching"] = profile.Caching result["create_option"] = profile.CreateOption result["os_type"] = profile.OsType @@ -1073,6 +1108,28 @@ func flattenAzureRmVirtualMachineScaleSetStorageProfileOSDisk(profile *compute.V return []interface{}{result} } +func flattenAzureStackVirtualMachineScaleSetStorageProfileDataDisk(disks *[]compute.VirtualMachineScaleSetDataDisk) interface{} { + result := make([]interface{}, len(*disks)) + for i, disk := range *disks { + l := make(map[string]interface{}) + if disk.ManagedDisk != nil { + l["managed_disk_type"] = string(disk.ManagedDisk.StorageAccountType) + } + + l["create_option"] = disk.CreateOption + l["caching"] = string(disk.Caching) + if disk.DiskSizeGB != nil { + l["disk_size_gb"] = *disk.DiskSizeGB + } + if v := disk.Lun; v != nil { + l["lun"] = *v + } + + result[i] = l + } + return result +} + func flattenAzureRmVirtualMachineScaleSetStorageProfileImageReference(image *compute.ImageReference) []interface{} { result := make(map[string]interface{}) if image.Publisher != nil { @@ -1428,8 +1485,9 @@ func expandAzureStackVirtualMachineScaleSetsStorageProfileOsDisk(d *schema.Resou caching := osDiskConfig["caching"].(string) osType := osDiskConfig["os_type"].(string) createOption := osDiskConfig["create_option"].(string) + managedDiskType := osDiskConfig["managed_disk_type"].(string) - if name == "" { + if managedDiskType == "" && name == "" { return nil, fmt.Errorf("[ERROR] `name` must be set in `storage_profile_os_disk` for unmanaged disk") } @@ -1455,9 +1513,71 @@ func expandAzureStackVirtualMachineScaleSetsStorageProfileOsDisk(d *schema.Resou osDisk.VhdContainers = &vhdContainers } + managedDisk := &compute.VirtualMachineScaleSetManagedDiskParameters{} + + if managedDiskType != "" { + if name != "" { + return nil, fmt.Errorf("[ERROR] Conflict between `name` and `managed_disk_type` on `storage_profile_os_disk` (please remove name or set it to blank)") + } + + osDisk.Name = nil + managedDisk.StorageAccountType = compute.StorageAccountTypes(managedDiskType) + osDisk.ManagedDisk = managedDisk + } + + //BEGIN: code to be removed after GH-13016 is merged + if image != "" && managedDiskType != "" { + return nil, fmt.Errorf("[ERROR] Conflict between `image` and `managed_disk_type` on `storage_profile_os_disk` (only one or the other can be used)") + } + + if len(vhd_containers) > 0 && managedDiskType != "" { + return nil, fmt.Errorf("[ERROR] Conflict between `vhd_containers` and `managed_disk_type` on `storage_profile_os_disk` (only one or the other can be used)") + } + //END: code to be removed after GH-13016 is merged + return osDisk, nil } +func expandAzureStackVirtualMachineScaleSetsStorageProfileDataDisk(d *schema.ResourceData) ([]compute.VirtualMachineScaleSetDataDisk, error) { + disks := d.Get("storage_profile_data_disk").([]interface{}) + dataDisks := make([]compute.VirtualMachineScaleSetDataDisk, 0, len(disks)) + for _, diskConfig := range disks { + config := diskConfig.(map[string]interface{}) + + createOption := config["create_option"].(string) + managedDiskType := config["managed_disk_type"].(string) + lun := int32(config["lun"].(int)) + + dataDisk := compute.VirtualMachineScaleSetDataDisk{ + Lun: &lun, + CreateOption: compute.DiskCreateOptionTypes(createOption), + } + + managedDiskVMSS := &compute.VirtualMachineScaleSetManagedDiskParameters{} + + if managedDiskType != "" { + managedDiskVMSS.StorageAccountType = compute.StorageAccountTypes(managedDiskType) + } else { + managedDiskVMSS.StorageAccountType = compute.StandardLRS + } + + // assume that data disks in VMSS can only be Managed Disks + dataDisk.ManagedDisk = managedDiskVMSS + if v := config["caching"].(string); v != "" { + dataDisk.Caching = compute.CachingTypes(v) + } + + if v := config["disk_size_gb"]; v != nil { + diskSize := int32(config["disk_size_gb"].(int)) + dataDisk.DiskSizeGB = &diskSize + } + + dataDisks = append(dataDisks, dataDisk) + } + + return dataDisks, nil +} + func expandAzureRmVirtualMachineScaleSetStorageProfileImageReference(d *schema.ResourceData) (*compute.ImageReference, error) { storageImageRefs := d.Get("storage_profile_image_reference").(*schema.Set).List() diff --git a/azurestack/resource_arm_virtual_machine_scale_set_test.go b/azurestack/resource_arm_virtual_machine_scale_set_test.go index 24dc8d264..b867864d5 100644 --- a/azurestack/resource_arm_virtual_machine_scale_set_test.go +++ b/azurestack/resource_arm_virtual_machine_scale_set_test.go @@ -20,7 +20,7 @@ func TestAccAzureStackVirtualMachineScaleSet_basic(t *testing.T) { resourceName := "azurestack_virtual_machine_scale_set.test" ri := acctest.RandInt() config := testAccAzureStackVirtualMachineScaleSet_basic(ri, testLocation()) - resource.Test(t, resource.TestCase{ + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testCheckAzureStackVirtualMachineScaleSetDestroy, @@ -47,7 +47,7 @@ func TestAccAzureStackVirtualMachineScaleSet_basicPublicIP(t *testing.T) { resourceName := "azurestack_virtual_machine_scale_set.test" ri := acctest.RandInt() config := testAccAzureStackVirtualMachineScaleSet_basicPublicIP(ri, testLocation()) - resource.Test(t, resource.TestCase{ + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testCheckAzureStackVirtualMachineScaleSetDestroy, @@ -70,7 +70,7 @@ func TestAccAzureStackVirtualMachineScaleSet_basicAcceleratedNetworking(t *testi resourceName := "azurestack_virtual_machine_scale_set.test" ri := acctest.RandInt() config := testAccAzureStackVirtualMachineScaleSet_basicAcceleratedNetworking(ri, testLocation()) - resource.Test(t, resource.TestCase{ + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testCheckAzureStackVirtualMachineScaleSetDestroy, @@ -98,7 +98,7 @@ func TestAccAzureStackVirtualMachineScaleSet_basicIPForwarding(t *testing.T) { networkProfile := map[string]interface{}{"name": networkProfileName, "primary": true} networkProfileHash := fmt.Sprintf("%d", resourceArmVirtualMachineScaleSetNetworkConfigurationHash(networkProfile)) config := testAccAzureStackVirtualMachineScaleSet_basicIPForwarding(ri, testLocation()) - resource.Test(t, resource.TestCase{ + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testCheckAzureStackVirtualMachineScaleSetDestroy, @@ -125,7 +125,7 @@ func TestAccAzureStackVirtualMachineScaleSet_basicDNSSettings(t *testing.T) { networkProfile := map[string]interface{}{"name": networkProfileName, "primary": true} networkProfileHash := fmt.Sprintf("%d", resourceArmVirtualMachineScaleSetNetworkConfigurationHash(networkProfile)) config := testAccAzureStackVirtualMachineScaleSet_basicDNSSettings(ri, testLocation()) - resource.Test(t, resource.TestCase{ + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testCheckAzureStackVirtualMachineScaleSetDestroy, @@ -150,7 +150,7 @@ func TestAccAzureStackVirtualMachineScaleSet_bootDiagnostic(t *testing.T) { resourceName := "azurestack_virtual_machine_scale_set.test" ri := acctest.RandInt() config := testAccAzureStackVirtualMachineScaleSet_bootDiagnostic(ri, testLocation()) - resource.Test(t, resource.TestCase{ + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testCheckAzureStackVirtualMachineScaleSetDestroy, @@ -170,7 +170,7 @@ func TestAccAzureStackVirtualMachineScaleSet_networkSecurityGroup(t *testing.T) resourceName := "azurestack_virtual_machine_scale_set.test" ri := acctest.RandInt() config := testAccAzureStackVirtualMachineScaleSet_networkSecurityGroup(ri, testLocation()) - resource.Test(t, resource.TestCase{ + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testCheckAzureStackVirtualMachineScaleSetDestroy, @@ -189,7 +189,7 @@ func TestAccAzureStackVirtualMachineScaleSet_basicWindows(t *testing.T) { resourceName := "azurestack_virtual_machine_scale_set.test" ri := acctest.RandInt() config := testAccAzureStackVirtualMachineScaleSet_basicWindows(ri, testLocation()) - resource.Test(t, resource.TestCase{ + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testCheckAzureStackVirtualMachineScaleSetDestroy, @@ -215,7 +215,7 @@ func TestAccAzureStackVirtualMachineScaleSet_singlePlacementGroupFalse(t *testin resourceName := "azurestack_virtual_machine_scale_set.test" ri := acctest.RandInt() config := testAccAzureStackVirtualMachineScaleSet_singlePlacementGroupFalse(ri, testLocation()) - resource.Test(t, resource.TestCase{ + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testCheckAzureStackVirtualMachineScaleSetDestroy, @@ -238,7 +238,7 @@ func TestAccAzureStackVirtualMachineScaleSet_linuxUpdated(t *testing.T) { config := testAccAzureStackVirtualMachineScaleSet_linux(ri, location) updatedConfig := testAccAzureStackVirtualMachineScaleSet_linuxUpdated(ri, location) - resource.Test(t, resource.TestCase{ + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testCheckAzureStackVirtualMachineScaleSetDestroy, @@ -268,7 +268,7 @@ func TestAccAzureStackVirtualMachineScaleSet_customDataUpdated(t *testing.T) { config := testAccAzureStackVirtualMachineScaleSet_linux(ri, location) updatedConfig := testAccAzureStackVirtualMachineScaleSet_linuxCustomDataUpdated(ri, location) - resource.Test(t, resource.TestCase{ + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testCheckAzureStackVirtualMachineScaleSetDestroy, @@ -289,16 +289,11 @@ func TestAccAzureStackVirtualMachineScaleSet_customDataUpdated(t *testing.T) { }) } -// Managed disks not supported yet - func TestAccAzureStackVirtualMachineScaleSet_basicLinux_managedDisk(t *testing.T) { - - t.Skip() - resourceName := "azurestack_virtual_machine_scale_set.test" ri := acctest.RandInt() config := testAccAzureStackVirtualMachineScaleSet_basicLinux_managedDisk(ri, testLocation()) - resource.Test(t, resource.TestCase{ + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testCheckAzureStackVirtualMachineScaleSetDestroy, @@ -313,15 +308,11 @@ func TestAccAzureStackVirtualMachineScaleSet_basicLinux_managedDisk(t *testing.T }) } -// Not yet supported by AzureStack func TestAccAzureStackVirtualMachineScaleSet_basicWindows_managedDisk(t *testing.T) { - - t.Skip() - resourceName := "azurestack_virtual_machine_scale_set.test" ri := acctest.RandInt() config := testAccAzureStackVirtualMachineScaleSet_basicWindows_managedDisk(ri, testLocation(), "Standard_D1_v2") - resource.Test(t, resource.TestCase{ + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testCheckAzureStackVirtualMachineScaleSetDestroy, @@ -336,16 +327,12 @@ func TestAccAzureStackVirtualMachineScaleSet_basicWindows_managedDisk(t *testing }) } -// Not yet supported by AzureStack func TestAccAzureStackVirtualMachineScaleSet_basicWindows_managedDisk_resize(t *testing.T) { - - t.Skip() - resourceName := "azurestack_virtual_machine_scale_set.test" ri := acctest.RandInt() preConfig := testAccAzureStackVirtualMachineScaleSet_basicWindows_managedDisk(ri, testLocation(), "Standard_D1_v2") postConfig := testAccAzureStackVirtualMachineScaleSet_basicWindows_managedDisk(ri, testLocation(), "Standard_D2_v2") - resource.Test(t, resource.TestCase{ + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testCheckAzureStackVirtualMachineScaleSetDestroy, @@ -366,15 +353,11 @@ func TestAccAzureStackVirtualMachineScaleSet_basicWindows_managedDisk_resize(t * }) } -// Not yet supported by AzureStack func TestAccAzureStackVirtualMachineScaleSet_basicLinux_managedDiskNoName(t *testing.T) { - - t.Skip() - resourceName := "azurestack_virtual_machine_scale_set.test" ri := acctest.RandInt() config := testAccAzureStackVirtualMachineScaleSet_basicLinux_managedDiskNoName(ri, testLocation()) - resource.Test(t, resource.TestCase{ + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testCheckAzureStackVirtualMachineScaleSetDestroy, @@ -393,7 +376,7 @@ func TestAccAzureStackVirtualMachineScaleSet_basicLinux_disappears(t *testing.T) resourceName := "azurestack_virtual_machine_scale_set.test" ri := acctest.RandInt() config := testAccAzureStackVirtualMachineScaleSet_basic(ri, testLocation()) - resource.Test(t, resource.TestCase{ + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testCheckAzureStackVirtualMachineScaleSetDestroy, @@ -410,15 +393,11 @@ func TestAccAzureStackVirtualMachineScaleSet_basicLinux_disappears(t *testing.T) }) } -// managed disk not supported yet func TestAccAzureStackVirtualMachineScaleSet_planManagedDisk(t *testing.T) { - - t.Skip() - resourceName := "azurestack_virtual_machine_scale_set.test" ri := acctest.RandInt() config := testAccAzureStackVirtualMachineScaleSet_planManagedDisk(ri, testLocation()) - resource.Test(t, resource.TestCase{ + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testCheckAzureStackVirtualMachineScaleSetDestroy, @@ -446,7 +425,7 @@ func TestAccAzureStackVirtualMachineScaleSet_customImage(t *testing.T) { config := testAccAzureStackVirtualMachineScaleSet_customImage(ri, testLocation(), userName, password, hostName) preConfig := testAccAzureStackImage_standaloneImage_setup(ri, userName, password, hostName, testLocation()) - resource.Test(t, resource.TestCase{ + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testCheckAzureStackVirtualMachineScaleSetDestroy, @@ -477,7 +456,7 @@ func TestAccAzureStackVirtualMachineScaleSet_applicationGateway(t *testing.T) { resourceName := "azurestack_virtual_machine_scale_set.test" ri := acctest.RandInt() config := testAccAzureStackVirtualMachineScaleSetApplicationGatewayTemplate(ri, testLocation()) - resource.Test(t, resource.TestCase{ + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testCheckAzureStackVirtualMachineScaleSetDestroy, @@ -497,7 +476,7 @@ func TestAccAzureStackVirtualMachineScaleSet_loadBalancer(t *testing.T) { resourceName := "azurestack_virtual_machine_scale_set.test" ri := acctest.RandInt() config := testAccAzureStackVirtualMachineScaleSetLoadBalancerTemplate(ri, testLocation()) - resource.Test(t, resource.TestCase{ + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testCheckAzureStackVirtualMachineScaleSetDestroy, @@ -513,14 +492,11 @@ func TestAccAzureStackVirtualMachineScaleSet_loadBalancer(t *testing.T) { }) } -// Managed disks not supported yet func TestAccAzureStackVirtualMachineScaleSet_loadBalancerManagedDataDisks(t *testing.T) { - t.Skip() - resourceName := "azurestack_virtual_machine_scale_set.test" ri := acctest.RandInt() config := testAccAzureStackVirtualMachineScaleSetLoadBalancerTemplateManagedDataDisks(ri, testLocation()) - resource.Test(t, resource.TestCase{ + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testCheckAzureStackVirtualMachineScaleSetDestroy, @@ -540,7 +516,7 @@ func TestAccAzureStackVirtualMachineScaleSet_overprovision(t *testing.T) { resourceName := "azurestack_virtual_machine_scale_set.test" ri := acctest.RandInt() config := testAccAzureStackVirtualMachineScaleSetOverProvisionTemplate(ri, testLocation()) - resource.Test(t, resource.TestCase{ + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testCheckAzureStackVirtualMachineScaleSetDestroy, @@ -560,7 +536,7 @@ func TestAccAzureStackVirtualMachineScaleSet_priority(t *testing.T) { resourceName := "azurestack_virtual_machine_scale_set.test" ri := acctest.RandInt() config := testAccAzureStackVirtualMachineScaleSetPriorityTemplate(ri, testLocation()) - resource.Test(t, resource.TestCase{ + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testCheckAzureStackVirtualMachineScaleSetDestroy, @@ -582,7 +558,7 @@ func TestAccAzureStackVirtualMachineScaleSet_MSI(t *testing.T) { resourceName := "azurestack_virtual_machine_scale_set.test" ri := acctest.RandInt() config := testAccAzureStackVirtualMachineScaleSetMSITemplate(ri, testLocation()) - resource.Test(t, resource.TestCase{ + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testCheckAzureStackVirtualMachineScaleSetDestroy, @@ -599,7 +575,7 @@ func TestAccAzureStackVirtualMachineScaleSet_extension(t *testing.T) { resourceName := "azurestack_virtual_machine_scale_set.test" ri := acctest.RandInt() config := testAccAzureStackVirtualMachineScaleSetExtensionTemplate(ri, testLocation()) - resource.Test(t, resource.TestCase{ + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testCheckAzureStackVirtualMachineScaleSetDestroy, @@ -621,7 +597,7 @@ func TestAccAzureStackVirtualMachineScaleSet_extensionUpdate(t *testing.T) { location := testLocation() config := testAccAzureStackVirtualMachineScaleSetExtensionTemplate(ri, location) updatedConfig := testAccAzureStackVirtualMachineScaleSetExtensionTemplateUpdated(ri, location) - resource.Test(t, resource.TestCase{ + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testCheckAzureStackVirtualMachineScaleSetDestroy, @@ -648,7 +624,7 @@ func TestAccAzureStackVirtualMachineScaleSet_multipleExtensions(t *testing.T) { resourceName := "azurestack_virtual_machine_scale_set.test" ri := acctest.RandInt() config := testAccAzureStackVirtualMachineScaleSetMultipleExtensionsTemplate(ri, testLocation()) - resource.Test(t, resource.TestCase{ + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testCheckAzureStackVirtualMachineScaleSetDestroy, @@ -664,12 +640,10 @@ func TestAccAzureStackVirtualMachineScaleSet_multipleExtensions(t *testing.T) { }) } -//osDiskTypeConflict must work when managed disk be supported. func TestAccAzureStackVirtualMachineScaleSet_osDiskTypeConflict(t *testing.T) { - t.Skip() ri := acctest.RandInt() config := testAccAzureStackVirtualMachineScaleSet_osDiskTypeConflict(ri, testLocation()) - resource.Test(t, resource.TestCase{ + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testCheckAzureStackVirtualMachineScaleSetDestroy, @@ -686,7 +660,7 @@ func TestAccAzureStackVirtualMachineScaleSet_NonStandardCasing(t *testing.T) { resourceName := "azurestack_virtual_machine_scale_set.test" ri := acctest.RandInt() config := testAccAzureStackVirtualMachineScaleSetNonStandardCasing(ri, testLocation()) - resource.Test(t, resource.TestCase{ + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testCheckAzureStackVirtualMachineScaleSetDestroy, @@ -711,7 +685,7 @@ func TestAccAzureStackVirtualMachineScaleSet_multipleNetworkProfiles(t *testing. resourceName := "azurestack_virtual_machine_scale_set.test" ri := acctest.RandInt() config := testAccAzureStackVirtualMachineScaleSet_multipleNetworkProfiles(ri, testLocation()) - resource.Test(t, resource.TestCase{ + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testCheckAzureStackVirtualMachineScaleSetDestroy, @@ -3459,7 +3433,7 @@ resource "azurestack_virtual_machine_scale_set" "test" { storage_profile_image_reference { publisher = "Canonical" offer = "UbuntuServer" - sku = "16.04.0-LTS" + sku = "16.04-LTS" version = "latest" } } @@ -3601,9 +3575,9 @@ resource "azurestack_virtual_machine_scale_set" "test" { } plan { - name = "os" - product = "rancheros" - publisher = "rancher" + name = "basic-byol" + publisher = "kemptech" + product = "vlm-azure" } storage_profile_os_disk { @@ -3613,9 +3587,9 @@ resource "azurestack_virtual_machine_scale_set" "test" { } storage_profile_image_reference { - publisher = "rancher" - offer = "rancheros" - sku = "os" + publisher = "Canonical" + offer = "UbuntuServer" + sku = "16.04-LTS" version = "latest" } } diff --git a/website/docs/r/virtual_machine_scale_set.html.markdown b/website/docs/r/virtual_machine_scale_set.html.markdown index 227dea513..4c0855487 100644 --- a/website/docs/r/virtual_machine_scale_set.html.markdown +++ b/website/docs/r/virtual_machine_scale_set.html.markdown @@ -125,6 +125,7 @@ The following arguments are supported: * `os_profile_linux_config` - (Required, when a linux machine) A Linux config block as documented below. * `network_profile` - (Required) A collection of network profile block as documented below. * `storage_profile_os_disk` - (Required) A storage profile os disk block as documented below +* `storage_profile_data_disk` - (Optional) A storage profile data disk block as documented below * `storage_profile_image_reference` - (Optional) A storage profile image reference block as documented below. * `extension` - (Optional) Can be specified multiple times to add extension profiles to the scale set. Each `extension` block supports the fields documented below. * `plan` - (Optional) A plan block as documented below.