Skip to content

Commit

Permalink
azurerm_cosmosdb_sql_container: fix crash when deleting (#13339)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbfrahry authored Sep 13, 2021
1 parent 6171e81 commit 3773ade
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions internal/services/cosmos/cosmosdb_sql_container_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,14 +416,14 @@ func resourceCosmosDbSQLContainerDelete(d *pluginsdk.ResourceData, meta interfac

future, err := client.DeleteSQLContainer(ctx, id.ResourceGroup, id.DatabaseAccountName, id.SqlDatabaseName, id.ContainerName)
if err != nil {
if !response.WasNotFound(future.Response()) {
return fmt.Errorf("deleting Cosmos SQL Container %q (Account: %q): %+v", id.SqlDatabaseName, id.ContainerName, err)
}
return fmt.Errorf("deleting Cosmos SQL Container %q (Account: %q): %+v", id.SqlDatabaseName, id.ContainerName, err)
}

err = future.WaitForCompletionRef(ctx, client.Client)
if err != nil {
return fmt.Errorf("waiting on delete future for Cosmos SQL Container %q (Account: %q): %+v", id.SqlDatabaseName, id.DatabaseAccountName, err)
if !response.WasNotFound(future.Response()) {
return fmt.Errorf("deleting Cosmos SQL Container %q (Account: %q): %+v", id.SqlDatabaseName, id.ContainerName, err)
}
}

return nil
Expand Down

0 comments on commit 3773ade

Please sign in to comment.