Skip to content

Commit

Permalink
providers/ultradns: handle record-not-found errors
Browse files Browse the repository at this point in the history
  • Loading branch information
josephholsten committed Oct 6, 2015
1 parent a95a46c commit 0a7a2f9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion builtin/providers/ultradns/resource_ultradns_record.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,13 @@ func resourceUltraDNSRecordRead(d *schema.ResourceData, meta interface{}) error

rrsets, _, err := client.RRSets.GetRRSets(d.Get("zone").(string), d.Get("name").(string), d.Get("type").(string))
if err != nil {
return fmt.Errorf("Couldn't find UltraDNS RRSet: %s", err)
// 70002 means Records Not Found
if err.(ErrorResponse).ErrorCode == 70002 {
d.SetId("")
return nil
} else {
return fmt.Errorf("Couldn't find UltraDNS RRSet: %s", err)
}
}
rec := rrsets[0]
err := d.Set("rdata", rec.RData)
Expand Down

0 comments on commit 0a7a2f9

Please sign in to comment.