From 00df2204a25f00801c35bd4ab441d6f289c6bad8 Mon Sep 17 00:00:00 2001 From: Brandon Tosch Date: Wed, 1 Mar 2017 18:32:03 -0800 Subject: [PATCH] fixed nil check in resourceArmVirtualMachineStorageOsDiskHash --- builtin/providers/azurerm/resource_arm_virtual_machine.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/builtin/providers/azurerm/resource_arm_virtual_machine.go b/builtin/providers/azurerm/resource_arm_virtual_machine.go index 2f1fbce77..7cc1d19b3 100644 --- a/builtin/providers/azurerm/resource_arm_virtual_machine.go +++ b/builtin/providers/azurerm/resource_arm_virtual_machine.go @@ -808,9 +808,11 @@ func resourceArmVirtualMachineStorageOsDiskHash(v interface{}) int { if m["vhd_uri"] != nil { buf.WriteString(fmt.Sprintf("%s-", m["vhd_uri"].(string))) } - managedDisk := m["managed_disk"].(map[string]interface{}) - if managedDisk["storage_account_type"] != nil { - buf.WriteString(fmt.Sprintf("%s-", managedDisk["storage_account_type"].(string))) + if m["managed_disk"] != nil { + managedDisk := m["managed_disk"].(map[string]interface{}) + if managedDisk["storage_account_type"] != nil { + buf.WriteString(fmt.Sprintf("%s-", managedDisk["storage_account_type"].(string))) + } } return hashcode.String(buf.String()) }