Skip to content

Commit

Permalink
Add request_condition to backend definistion (#11238)
Browse files Browse the repository at this point in the history
  • Loading branch information
msuterski authored and stack72 committed Jan 18, 2017
1 parent 5a87cd3 commit 1f520bc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions builtin/providers/fastly/resource_fastly_service_v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,12 @@ func resourceServiceV1() *schema.Resource {
Default: 80,
Description: "The port number Backend responds on. Default 80",
},
"request_condition": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Default: "",
Description: "Condition, which if met, will select this backend during a request.",
},
"shield": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -833,6 +839,7 @@ func resourceServiceV1Update(d *schema.ResourceData, meta interface{}) error {
FirstByteTimeout: uint(df["first_byte_timeout"].(int)),
MaxConn: uint(df["max_conn"].(int)),
Weight: uint(df["weight"].(int)),
RequestCondition: df["request_condition"].(string),
}

log.Printf("[DEBUG] Create Backend Opts: %#v", opts)
Expand Down Expand Up @@ -1510,6 +1517,7 @@ func flattenBackends(backendList []*gofastly.Backend) []map[string]interface{} {
"ssl_check_cert": gofastly.CBool(b.SSLCheckCert),
"ssl_hostname": b.SSLHostname,
"weight": int(b.Weight),
"request_condition": b.RequestCondition,
}

bl = append(bl, nb)
Expand Down
2 changes: 2 additions & 0 deletions builtin/providers/fastly/resource_fastly_service_v1_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ func TestResourceFastlyFlattenBackend(t *testing.T) {
ErrorThreshold: uint(0),
FirstByteTimeout: uint(15000),
MaxConn: uint(200),
RequestCondition: "",
SSLCheckCert: true,
SSLHostname: "",
Shield: "New York",
Expand All @@ -87,6 +88,7 @@ func TestResourceFastlyFlattenBackend(t *testing.T) {
"error_threshold": 0,
"first_byte_timeout": 15000,
"max_conn": 200,
"request_condition": "",
"ssl_check_cert": gofastly.CBool(true),
"ssl_hostname": "",
"shield": "New York",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ Default `1000`
* `max_conn` - (Optional) Maximum number of connections for this Backend.
Default `200`.
* `port` - (Optional) The port number on which the Backend responds. Default `80`.
* `request_condition` - (Optional, string) Condition, which if met, will select this backend during a request.
* `ssl_check_cert` - (Optional) Be strict about checking SSL certs. Default `true`.
* `ssl_hostname` - (Optional) Used for both SNI during the TLS handshake and to validate the cert.
* `shield` - (Optional) The POP of the shield designated to reduce inbound load.
Expand Down

0 comments on commit 1f520bc

Please sign in to comment.