From 9419979a1c6dbfff329b5b32cae24fd19d5de60b Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Tue, 23 Jan 2018 16:40:30 +0100 Subject: [PATCH] Handling the Storage Account Type being case insensitive --- azurerm/resource_arm_managed_disk.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/azurerm/resource_arm_managed_disk.go b/azurerm/resource_arm_managed_disk.go index e66c44316b8b..d531e5136ebb 100644 --- a/azurerm/resource_arm_managed_disk.go +++ b/azurerm/resource_arm_managed_disk.go @@ -37,8 +37,8 @@ func resourceArmManagedDisk() *schema.Resource { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(compute.PremiumLRS), string(compute.StandardLRS), + string(compute.PremiumLRS), }, true), DiffSuppressFunc: ignoreCaseDiffSuppressFunc, }, @@ -119,6 +119,13 @@ func resourceArmManagedDiskCreate(d *schema.ResourceData, meta interface{}) erro tags := d.Get("tags").(map[string]interface{}) expandedTags := expandTags(tags) + var skuName compute.StorageAccountTypes + if strings.ToLower(storageAccountType) == strings.ToLower(string(compute.PremiumLRS)) { + skuName = compute.PremiumLRS + } else { + skuName = compute.StandardLRS + } + createDisk := compute.Disk{ Name: &name, Location: &location, @@ -126,7 +133,7 @@ func resourceArmManagedDiskCreate(d *schema.ResourceData, meta interface{}) erro OsType: compute.OperatingSystemTypes(osType), }, Sku: &compute.DiskSku{ - Name: compute.StorageAccountTypes(storageAccountType), + Name: (skuName), }, Tags: expandedTags, }