Skip to content

Commit

Permalink
Handling the Storage Account Type being case insensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
tombuildsstuff committed Jan 23, 2018
1 parent 6bc4ac3 commit 9419979
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions azurerm/resource_arm_managed_disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down Expand Up @@ -119,14 +119,21 @@ 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,
DiskProperties: &compute.DiskProperties{
OsType: compute.OperatingSystemTypes(osType),
},
Sku: &compute.DiskSku{
Name: compute.StorageAccountTypes(storageAccountType),
Name: (skuName),
},
Tags: expandedTags,
}
Expand Down

0 comments on commit 9419979

Please sign in to comment.