Use content as id.

This commit is contained in:
Joern Barthel 2016-08-05 17:08:50 +02:00
parent e21203a369
commit 67b4b4cbfb
1 changed files with 4 additions and 2 deletions

View File

@ -6,9 +6,10 @@ import (
"io/ioutil"
"log"
"sort"
"time"
"strconv"
"github.com/hashicorp/go-cleanhttp"
"github.com/hashicorp/terraform/helper/hashcode"
"github.com/hashicorp/terraform/helper/schema"
)
@ -35,7 +36,6 @@ func dataSourceFastlyIPRangesRead(d *schema.ResourceData, meta interface{}) erro
conn := cleanhttp.DefaultClient()
log.Printf("[DEBUG] Reading IP ranges")
d.SetId(time.Now().UTC().String())
res, err := conn.Get("https://api.fastly.com/public-ip-list")
@ -51,6 +51,8 @@ func dataSourceFastlyIPRangesRead(d *schema.ResourceData, meta interface{}) erro
return fmt.Errorf("Error reading response body: %s", err)
}
d.SetId(strconv.Itoa(hashcode.String(string(data))))
result := new(dataSourceFastlyIPRangesResult)
if err := json.Unmarshal(data, result); err != nil {