diff --git a/azurerm/internal/services/machinelearning/machine_learning_workspace_resource.go b/azurerm/internal/services/machinelearning/machine_learning_workspace_resource.go index 2b2a2945f073..9e48803680a2 100644 --- a/azurerm/internal/services/machinelearning/machine_learning_workspace_resource.go +++ b/azurerm/internal/services/machinelearning/machine_learning_workspace_resource.go @@ -327,10 +327,15 @@ func resourceArmMachineLearningWorkspaceDelete(d *schema.ResourceData, meta inte return fmt.Errorf("Error parsing Machine Learning Workspace ID `%q`: %+v", d.Id(), err) } - if _, err := client.Delete(ctx, id.ResourceGroup, id.Name); err != nil { + future, err := client.Delete(ctx, id.ResourceGroup, id.Name) + if err != nil { return fmt.Errorf("Error deleting Machine Learning Workspace %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) } + if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("Error waiting for deletion of Machine Learning Workspace %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + } + return nil }