Skip to content

Commit

Permalink
fix: Show error when DNS zone doesn't exist
Browse files Browse the repository at this point in the history
Closes #14
  • Loading branch information
timohirt committed Sep 7, 2020
1 parent 31efb57 commit 8ec2d67
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions hetznerdns/data_source_zone.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ func dataSourceHetznerDNSZoneRead(d *schema.ResourceData, m interface{}) error {
return fmt.Errorf("Error getting zone state. %s", err)
}

if zone == nil {
return fmt.Errorf("DNS zone '%s' doesn't exist", name.(string))
}

d.Set("name", zone.Name)
d.Set("ttl", zone.TTL)
d.SetId(zone.ID)
Expand Down

0 comments on commit 8ec2d67

Please sign in to comment.