unless id is set, txt record set is not available

This commit is contained in:
S. Brent Faulkner 2017-05-07 11:43:52 -04:00
parent 8165e2e96f
commit a67d487aa5
1 changed files with 3 additions and 0 deletions

View File

@ -34,6 +34,7 @@ func dataSourceDnsTxtRecordSet() *schema.Resource {
func dataSourceDnsTxtRecordSetRead(d *schema.ResourceData, meta interface{}) error { func dataSourceDnsTxtRecordSetRead(d *schema.ResourceData, meta interface{}) error {
host := d.Get("host").(string) host := d.Get("host").(string)
records, err := net.LookupTXT(host) records, err := net.LookupTXT(host)
if err != nil { if err != nil {
return fmt.Errorf("error looking up TXT records for %q: %s", host, err) return fmt.Errorf("error looking up TXT records for %q: %s", host, err)
@ -45,5 +46,7 @@ func dataSourceDnsTxtRecordSetRead(d *schema.ResourceData, meta interface{}) err
d.Set("record", "") d.Set("record", "")
} }
d.Set("records", records) d.Set("records", records)
d.SetId(host)
return nil return nil
} }