diff --git a/builtin/providers/azurerm/resource_arm_virtual_machine_extension.go b/builtin/providers/azurerm/resource_arm_virtual_machine_extension.go index b75df50c7..129e205c5 100644 --- a/builtin/providers/azurerm/resource_arm_virtual_machine_extension.go +++ b/builtin/providers/azurerm/resource_arm_virtual_machine_extension.go @@ -153,13 +153,14 @@ func resourceArmVirtualMachineExtensionsRead(d *schema.ResourceData, meta interf name := id.Path["extensions"] resp, err := client.Get(resGroup, vmName, name, "") + if err != nil { + if resp.StatusCode == http.StatusNotFound { + d.SetId("") + return nil + } return fmt.Errorf("Error making Read request on Virtual Machine Extension %s: %s", name, err) } - if resp.StatusCode == http.StatusNotFound { - d.SetId("") - return nil - } d.Set("name", resp.Name) d.Set("location", azureRMNormalizeLocation(*resp.Location))