Skip to content

Commit

Permalink
Bump cloudflare-go to ce422d1 (#271)
Browse files Browse the repository at this point in the history
* Bump cloudflare-go to ce422d1

* Update rateLimit.Correlate to be a pointer

* Bump cloudflare-go to ab6ea5d

* rate_limit: Don't set correlate unless it's needed

We only want to set `rateLimit.Correlate` when it's required. This stops
the value from continiously being updated in the Terraform state but not
changed in the remote.

Closes #256
  • Loading branch information
jacobbednarz authored and patryk committed Mar 27, 2019
1 parent 49f6cc7 commit 08aa117
Show file tree
Hide file tree
Showing 15 changed files with 397 additions and 65 deletions.
9 changes: 6 additions & 3 deletions cloudflare/resource_cloudflare_rate_limit.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,15 +393,15 @@ func expandRateLimitAction(d *schema.ResourceData) (action cloudflare.RateLimitA
return action, nil
}

func expandRateLimitCorrelate(d *schema.ResourceData) (correlate cloudflare.RateLimitCorrelate, err error) {
func expandRateLimitCorrelate(d *schema.ResourceData) (correlate *cloudflare.RateLimitCorrelate, err error) {
v, ok := d.GetOk("correlate")
if !ok {
return
}

tfCorrelate := v.([]interface{})[0].(map[string]interface{})

correlate = cloudflare.RateLimitCorrelate{
correlate = &cloudflare.RateLimitCorrelate{
By: tfCorrelate["by"].(string),
}

Expand Down Expand Up @@ -446,7 +446,10 @@ func resourceCloudflareRateLimitRead(d *schema.ResourceData, meta interface{}) e
log.Printf("[WARN] Error setting action on rate limit %q: %s", d.Id(), err)
}

d.Set("correlate", flattenRateLimitCorrelate(rateLimit.Correlate))
if rateLimit.Correlate != nil {
d.Set("correlate", flattenRateLimitCorrelate(*rateLimit.Correlate))
}

d.Set("description", rateLimit.Description)
d.Set("disabled", rateLimit.Disabled)

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/armon/go-radix v1.0.0 // indirect
github.com/aws/aws-sdk-go v1.18.3 // indirect
github.com/blang/semver v3.5.1+incompatible // indirect
github.com/cloudflare/cloudflare-go v0.0.0-20190123152938-9837a599c0ba
github.com/cloudflare/cloudflare-go v0.8.6-0.20190327000105-ab6ea5d38409
github.com/hashicorp/go-cleanhttp v0.5.0
github.com/hashicorp/go-getter v1.2.0 // indirect
github.com/hashicorp/go-hclog v0.8.0 // indirect
Expand Down
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ github.com/chzyer/readline v0.0.0-20161106042343-c914be64f07d/go.mod h1:nSuG5e5P
github.com/chzyer/test v0.0.0-20160617131543-bea8f082b6fd/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/client9/misspell v0.3.4 h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cloudflare/cloudflare-go v0.0.0-20190123152938-9837a599c0ba h1:BneYz3wK+QFvatwOnkKWm/lwA1Ix+kOV1whaDaG8Xz0=
github.com/cloudflare/cloudflare-go v0.0.0-20190123152938-9837a599c0ba/go.mod h1:qKQ9S///VKEax9N8kFel9/AvmnkYgvb8uiKTnoVFvpg=
github.com/cloudflare/cloudflare-go v0.8.6-0.20190327000105-ab6ea5d38409 h1:QVcUh7/upMWnSzYuGp71O4XzFi6GWmmi2QidzDGRrdQ=
github.com/cloudflare/cloudflare-go v0.8.6-0.20190327000105-ab6ea5d38409/go.mod h1:wqCYq1S9oX9sYJ5O8rF6z8qocTG+vA35evLmFE2Qi60=
github.com/codegangsta/cli v1.20.0/go.mod h1:/qJNoX69yVSKu5o4jLyXAENLRyk1uhi7zkbQ3slBdOA=
github.com/coreos/bbolt v1.3.1-coreos.1/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
github.com/coreos/etcd v3.2.0-rc.1.0.20170908195435-80aa810309d4+incompatible h1:VLCxgrfBsnJtqTy0WFP0GsjjwWZQiuQiNgiWnY6g6Gc=
Expand Down Expand Up @@ -398,6 +398,7 @@ golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL
golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/net v0.0.0-20171004034648-a04bdaca5b32/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down Expand Up @@ -448,6 +449,7 @@ golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGm
golang.org/x/tools v0.0.0-20181030000716-a0a13e073c7b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
golang.org/x/tools v0.0.0-20190228203856-589c23e65e65/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
google.golang.org/api v0.0.0-20171005000305-7a7376eff6a5 h1:PDkJGYjSvxJyevtZRGmBSO+HjbIKuqYEEc8gB51or4o=
google.golang.org/api v0.0.0-20171005000305-7a7376eff6a5/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
Expand Down
15 changes: 3 additions & 12 deletions vendor/github.com/cloudflare/cloudflare-go/.travis.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions vendor/github.com/cloudflare/cloudflare-go/account_members.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions vendor/github.com/cloudflare/cloudflare-go/duration.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions vendor/github.com/cloudflare/cloudflare-go/errors.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion vendor/github.com/cloudflare/cloudflare-go/go.mod

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions vendor/github.com/cloudflare/cloudflare-go/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 45 additions & 0 deletions vendor/github.com/cloudflare/cloudflare-go/load_balancing.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 08aa117

Please sign in to comment.