Skip to content

Commit

Permalink
Refactoring the PTR record
Browse files Browse the repository at this point in the history
  • Loading branch information
tombuildsstuff committed Jul 26, 2017
1 parent 57fbce9 commit df0e6e0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions azurerm/resource_arm_dns_ptr_record.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,13 @@ func resourceArmDnsPtrRecordRead(d *schema.ResourceData, meta interface{}) error

resp, err := dnsClient.Get(resGroup, zoneName, name, dns.PTR)
if err != nil {
if resp.StatusCode == http.StatusNotFound {
d.SetId("")
return nil
}

return fmt.Errorf("Error reading DNS PTR record %s: %+v", name, err)
}
if resp.StatusCode == http.StatusNotFound {
d.SetId("")
return nil
}

d.Set("name", name)
d.Set("resource_group_name", resGroup)
Expand Down
4 changes: 2 additions & 2 deletions azurerm/resource_arm_dns_ptr_record_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,14 @@ func testCheckAzureRMDnsPtrRecordDestroy(s *terraform.State) error {
resp, err := conn.Get(resourceGroup, zoneName, ptrName, dns.PTR)

if err != nil {
if resp.StatusCode != http.StatusNotFound {
if resp.StatusCode == http.StatusNotFound {
return nil
}

return err
}

fmt.Errorf("DNS PTR record still exists:\n%#v", resp)
return fmt.Errorf("DNS PTR record still exists:\n%#v", resp)
}

return nil
Expand Down

0 comments on commit df0e6e0

Please sign in to comment.