From 189e34f019337e0753546e89bc839c070df1b5e8 Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Thu, 24 Oct 2019 19:13:50 +0200 Subject: [PATCH] r/virtual_machine: handling `plan` having no elements Fixes #4673 --- azurerm/resource_arm_virtual_machine.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/azurerm/resource_arm_virtual_machine.go b/azurerm/resource_arm_virtual_machine.go index b753da4b8205..2681129ba04f 100644 --- a/azurerm/resource_arm_virtual_machine.go +++ b/azurerm/resource_arm_virtual_machine.go @@ -1406,6 +1406,9 @@ func flattenAzureRmVirtualMachineReviseDiskInfo(result map[string]interface{}, d func expandAzureRmVirtualMachinePlan(d *schema.ResourceData) (*compute.Plan, error) { planConfigs := d.Get("plan").([]interface{}) + if len(planConfigs) == 0 { + return nil, nil + } planConfig := planConfigs[0].(map[string]interface{})