diff --git a/builtin/providers/azurerm/resource_arm_documentdb.go b/builtin/providers/azurerm/resource_arm_documentdb.go index 4cb14562367f..67f397d4a1e2 100644 --- a/builtin/providers/azurerm/resource_arm_documentdb.go +++ b/builtin/providers/azurerm/resource_arm_documentdb.go @@ -160,7 +160,8 @@ func resourceArmDocumentDBCreateUpdate(d *schema.ResourceData, meta interface{}) Tags: expandTags(tags), } - _, err = client.CreateOrUpdate(resGroup, name, parameters, make(chan struct{})) + _, error := client.CreateOrUpdate(resGroup, name, parameters, make(chan struct{})) + err = <-error if err != nil { return err } @@ -237,12 +238,18 @@ func resourceArmDocumentDBDelete(d *schema.ResourceData, meta interface{}) error resGroup := id.ResourceGroup name := id.Path["databaseAccounts"] - resp, err := client.Delete(resGroup, name, make(chan struct{})) + deleteResp, error := client.Delete(resGroup, name, make(chan struct{})) + resp := <-deleteResp + err = <-error if resp.StatusCode != http.StatusOK { return fmt.Errorf("Error issuing AzureRM delete request for DocumentDB instance '%s': %s", name, err) } + if err != nil { + return err + } + return nil } diff --git a/builtin/providers/azurerm/resource_arm_documentdb_test.go b/builtin/providers/azurerm/resource_arm_documentdb_test.go index 6830ca7ed9a5..66f1c6172a09 100644 --- a/builtin/providers/azurerm/resource_arm_documentdb_test.go +++ b/builtin/providers/azurerm/resource_arm_documentdb_test.go @@ -148,7 +148,7 @@ resource "azurerm_resource_group" "test" { location = "West US" } resource "azurerm_documentdb" "test" { - name = "acctestDDB-%d" + name = "acctest-%d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" offer_type = "Standard" @@ -172,7 +172,7 @@ resource "azurerm_resource_group" "test" { location = "West US" } resource "azurerm_documentdb" "test" { - name = "acctestDDB-%d" + name = "acctest-%d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" offer_type = "Standard"