Skip to content

Commit bf52f38

Browse files
committed
providers/digitalocean: if delete droplet returns 404, mark as gone
1 parent fc93ea4 commit bf52f38

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

builtin/providers/digitalocean/resource_digitalocean_record.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package digitalocean
33
import (
44
"fmt"
55
"log"
6+
"strings"
67

78
"github.com/hashicorp/terraform/helper/config"
89
"github.com/hashicorp/terraform/helper/diff"
@@ -91,6 +92,13 @@ func resource_digitalocean_record_destroy(
9192
err := client.DestroyRecord(s.Attributes["domain"], s.ID)
9293

9394
if err != nil {
95+
96+
// If the record is somehow already destroyed, mark as
97+
// succesfully gone
98+
if strings.Contains(err.Error(), "404 Not Found") {
99+
return nil
100+
}
101+
94102
return fmt.Errorf("Error deleting record: %s", err)
95103
}
96104

0 commit comments

Comments
 (0)