Skip to content

Commit 563e78e

Browse files
committed
Revert "fix(backend): remove redundant error_threshold attribute (#731)" (#736)
* Revert "fix(backend): remove redundant error_threshold attribute (#731)" This reverts commit 81629f5. * build: bump go-fastly to latest 5.8.9 release
1 parent 5c16f56 commit 563e78e

File tree

10 files changed

+28
-6
lines changed

10 files changed

+28
-6
lines changed

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ terraform {
2525
required_providers {
2626
fastly = {
2727
source = "fastly/fastly"
28-
version = ">= 5.3.0"
28+
version = ">= 5.3.1"
2929
}
3030
}
3131
}

docs/resources/service_compute.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ Optional:
140140

141141
- `between_bytes_timeout` (Number) How long to wait between bytes in milliseconds. Default `10000`
142142
- `connect_timeout` (Number) How long to wait for a timeout in milliseconds. Default `1000`
143+
- `error_threshold` (Number) Number of errors to allow before the Backend is marked as down. Default `0`
143144
- `first_byte_timeout` (Number) How long to wait for the first bytes in milliseconds. Default `15000`
144145
- `healthcheck` (String) Name of a defined `healthcheck` to assign to this backend
145146
- `keepalive_time` (Number) How long in seconds to keep a persistent connection to the backend between requests.

docs/resources/service_vcl.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@ Optional:
342342
- `auto_loadbalance` (Boolean) Denotes if this Backend should be included in the pool of backends that requests are load balanced against. Default `false`
343343
- `between_bytes_timeout` (Number) How long to wait between bytes in milliseconds. Default `10000`
344344
- `connect_timeout` (Number) How long to wait for a timeout in milliseconds. Default `1000`
345+
- `error_threshold` (Number) Number of errors to allow before the Backend is marked as down. Default `0`
345346
- `first_byte_timeout` (Number) How long to wait for the first bytes in milliseconds. Default `15000`
346347
- `healthcheck` (String) Name of a defined `healthcheck` to assign to this backend
347348
- `keepalive_time` (Number) How long in seconds to keep a persistent connection to the backend between requests.

fastly/block_fastly_service_backend.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ func (h *BackendServiceAttributeHandler) GetSchema() *schema.Schema {
4949
Default: 1000,
5050
Description: "How long to wait for a timeout in milliseconds. Default `1000`",
5151
},
52+
"error_threshold": {
53+
Type: schema.TypeInt,
54+
Optional: true,
55+
Default: 0,
56+
Description: "Number of errors to allow before the Backend is marked as down. Default `0`",
57+
},
5258
"first_byte_timeout": {
5359
Type: schema.TypeInt,
5460
Optional: true,
@@ -271,6 +277,7 @@ func (h *BackendServiceAttributeHandler) buildCreateBackendInput(service string,
271277
Address: gofastly.String(resource["address"].(string)),
272278
BetweenBytesTimeout: gofastly.Int(resource["between_bytes_timeout"].(int)),
273279
ConnectTimeout: gofastly.Int(resource["connect_timeout"].(int)),
280+
ErrorThreshold: gofastly.Int(resource["error_threshold"].(int)),
274281
FirstByteTimeout: gofastly.Int(resource["first_byte_timeout"].(int)),
275282
HealthCheck: gofastly.String(resource["healthcheck"].(string)),
276283
MaxConn: gofastly.Int(resource["max_conn"].(int)),
@@ -353,6 +360,9 @@ func (h *BackendServiceAttributeHandler) buildUpdateBackendInput(serviceID strin
353360
if v, ok := modified["max_conn"]; ok {
354361
opts.MaxConn = gofastly.Int(v.(int))
355362
}
363+
if v, ok := modified["error_threshold"]; ok {
364+
opts.ErrorThreshold = gofastly.Int(v.(int))
365+
}
356366
if v, ok := modified["first_byte_timeout"]; ok {
357367
opts.FirstByteTimeout = gofastly.Int(v.(int))
358368
}
@@ -421,6 +431,7 @@ func flattenBackend(remoteState []*gofastly.Backend, sa ServiceMetadata) []map[s
421431
"address": resource.Address,
422432
"between_bytes_timeout": int(resource.BetweenBytesTimeout),
423433
"connect_timeout": int(resource.ConnectTimeout),
434+
"error_threshold": int(resource.ErrorThreshold),
424435
"first_byte_timeout": int(resource.FirstByteTimeout),
425436
"healthcheck": resource.HealthCheck,
426437
"keepalive_time": int(resource.KeepAliveTime),

fastly/block_fastly_service_backend_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ func TestResourceFastlyFlattenBackend(t *testing.T) {
3030
AutoLoadbalance: false,
3131
BetweenBytesTimeout: 10000,
3232
ConnectTimeout: 1000,
33+
ErrorThreshold: 0,
3334
FirstByteTimeout: 15000,
3435
KeepAliveTime: 1500,
3536
MaxConn: 200,
@@ -58,6 +59,7 @@ func TestResourceFastlyFlattenBackend(t *testing.T) {
5859
"auto_loadbalance": false,
5960
"between_bytes_timeout": 10000,
6061
"connect_timeout": 1000,
62+
"error_threshold": 0,
6163
"first_byte_timeout": 15000,
6264
"keepalive_time": 1500,
6365
"max_conn": 200,
@@ -106,6 +108,7 @@ func TestResourceFastlyFlattenBackendCompute(t *testing.T) {
106108
Port: 80,
107109
BetweenBytesTimeout: 10000,
108110
ConnectTimeout: 1000,
111+
ErrorThreshold: 0,
109112
FirstByteTimeout: 15000,
110113
KeepAliveTime: 1500,
111114
MaxConn: 200,
@@ -133,6 +136,7 @@ func TestResourceFastlyFlattenBackendCompute(t *testing.T) {
133136
"port": 80,
134137
"between_bytes_timeout": 10000,
135138
"connect_timeout": 1000,
139+
"error_threshold": 0,
136140
"first_byte_timeout": 15000,
137141
"keepalive_time": 1500,
138142
"max_conn": 200,

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.18
44

55
require (
66
github.com/bflad/tfproviderlint v0.29.0
7-
github.com/fastly/go-fastly/v8 v8.5.8
7+
github.com/fastly/go-fastly/v8 v8.5.9
88
github.com/google/go-cmp v0.5.9
99
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
1010
github.com/hashicorp/terraform-plugin-docs v0.16.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
3232
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
3333
github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI=
3434
github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc=
35-
github.com/fastly/go-fastly/v8 v8.5.8 h1:BgHcPmCp7mXgqpbdDWU+m3/tE6CBAvJPygZaaJsExIM=
36-
github.com/fastly/go-fastly/v8 v8.5.8/go.mod h1:jmjaUGq1RUdP05XOuD1ICvuuzo0EdCexShviy2sFfHU=
35+
github.com/fastly/go-fastly/v8 v8.5.9 h1:DAebgYDu60MF9BO2cqKFSfvMfgn85L6ycMSy3PYfFNU=
36+
github.com/fastly/go-fastly/v8 v8.5.9/go.mod h1:jmjaUGq1RUdP05XOuD1ICvuuzo0EdCexShviy2sFfHU=
3737
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
3838
github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
3939
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=

vendor/github.com/fastly/go-fastly/v8/fastly/backend.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/fastly/go-fastly/v8/fastly/client.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/modules.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ github.com/cloudflare/circl/sign/ed448
211211
# github.com/davecgh/go-spew v1.1.1
212212
## explicit
213213
github.com/davecgh/go-spew/spew
214-
# github.com/fastly/go-fastly/v8 v8.5.8
214+
# github.com/fastly/go-fastly/v8 v8.5.9
215215
## explicit; go 1.18
216216
github.com/fastly/go-fastly/v8/fastly
217217
# github.com/fatih/color v1.13.0

0 commit comments

Comments
 (0)