func resourceDNSRead(d *schema.ResourceData, m interface{}) error { ips, err := getIPs(d.Get("host").(string)) if err != nil { return err } if len(ips) == 0 { return fmt.Errorf("No IP addresses found for %s", d.Get("host")) } d.Set("ip_address", ips[0]) d.Set("ip_address_csv", strings.Join(ips, ",")) return nil }