Use content as id.
This commit is contained in:
parent
e21203a369
commit
67b4b4cbfb
|
@ -6,9 +6,10 @@ import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"sort"
|
"sort"
|
||||||
"time"
|
"strconv"
|
||||||
|
|
||||||
"github.com/hashicorp/go-cleanhttp"
|
"github.com/hashicorp/go-cleanhttp"
|
||||||
|
"github.com/hashicorp/terraform/helper/hashcode"
|
||||||
"github.com/hashicorp/terraform/helper/schema"
|
"github.com/hashicorp/terraform/helper/schema"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -35,7 +36,6 @@ func dataSourceFastlyIPRangesRead(d *schema.ResourceData, meta interface{}) erro
|
||||||
conn := cleanhttp.DefaultClient()
|
conn := cleanhttp.DefaultClient()
|
||||||
|
|
||||||
log.Printf("[DEBUG] Reading IP ranges")
|
log.Printf("[DEBUG] Reading IP ranges")
|
||||||
d.SetId(time.Now().UTC().String())
|
|
||||||
|
|
||||||
res, err := conn.Get("https://api.fastly.com/public-ip-list")
|
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)
|
return fmt.Errorf("Error reading response body: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
d.SetId(strconv.Itoa(hashcode.String(string(data))))
|
||||||
|
|
||||||
result := new(dataSourceFastlyIPRangesResult)
|
result := new(dataSourceFastlyIPRangesResult)
|
||||||
|
|
||||||
if err := json.Unmarshal(data, result); err != nil {
|
if err := json.Unmarshal(data, result); err != nil {
|
||||||
|
|
Loading…
Reference in New Issue