Skip to content

Commit 67b4b4c

Browse files
committed
Use content as id.
1 parent e21203a commit 67b4b4c

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

builtin/providers/fastly/data_source_ip_ranges.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ import (
66
"io/ioutil"
77
"log"
88
"sort"
9-
"time"
9+
"strconv"
1010

1111
"github.com/hashicorp/go-cleanhttp"
12+
"github.com/hashicorp/terraform/helper/hashcode"
1213
"github.com/hashicorp/terraform/helper/schema"
1314
)
1415

@@ -35,7 +36,6 @@ func dataSourceFastlyIPRangesRead(d *schema.ResourceData, meta interface{}) erro
3536
conn := cleanhttp.DefaultClient()
3637

3738
log.Printf("[DEBUG] Reading IP ranges")
38-
d.SetId(time.Now().UTC().String())
3939

4040
res, err := conn.Get("https://api.fastly.com/public-ip-list")
4141

@@ -51,6 +51,8 @@ func dataSourceFastlyIPRangesRead(d *schema.ResourceData, meta interface{}) erro
5151
return fmt.Errorf("Error reading response body: %s", err)
5252
}
5353

54+
d.SetId(strconv.Itoa(hashcode.String(string(data))))
55+
5456
result := new(dataSourceFastlyIPRangesResult)
5557

5658
if err := json.Unmarshal(data, result); err != nil {

0 commit comments

Comments
 (0)