Add request_condition to backend definistion (#11238)

This commit is contained in:
Marcin Suterski 2017-01-18 08:43:09 -05:00 committed by Paul Stack
parent 5a87cd30de
commit 1f520bcd3b
3 changed files with 11 additions and 0 deletions

View File

@ -166,6 +166,12 @@ func resourceServiceV1() *schema.Resource {
Default: 80, Default: 80,
Description: "The port number Backend responds on. 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{ "shield": &schema.Schema{
Type: schema.TypeString, Type: schema.TypeString,
Optional: true, Optional: true,
@ -833,6 +839,7 @@ func resourceServiceV1Update(d *schema.ResourceData, meta interface{}) error {
FirstByteTimeout: uint(df["first_byte_timeout"].(int)), FirstByteTimeout: uint(df["first_byte_timeout"].(int)),
MaxConn: uint(df["max_conn"].(int)), MaxConn: uint(df["max_conn"].(int)),
Weight: uint(df["weight"].(int)), Weight: uint(df["weight"].(int)),
RequestCondition: df["request_condition"].(string),
} }
log.Printf("[DEBUG] Create Backend Opts: %#v", opts) log.Printf("[DEBUG] Create Backend Opts: %#v", opts)
@ -1510,6 +1517,7 @@ func flattenBackends(backendList []*gofastly.Backend) []map[string]interface{} {
"ssl_check_cert": gofastly.CBool(b.SSLCheckCert), "ssl_check_cert": gofastly.CBool(b.SSLCheckCert),
"ssl_hostname": b.SSLHostname, "ssl_hostname": b.SSLHostname,
"weight": int(b.Weight), "weight": int(b.Weight),
"request_condition": b.RequestCondition,
} }
bl = append(bl, nb) bl = append(bl, nb)

View File

@ -70,6 +70,7 @@ func TestResourceFastlyFlattenBackend(t *testing.T) {
ErrorThreshold: uint(0), ErrorThreshold: uint(0),
FirstByteTimeout: uint(15000), FirstByteTimeout: uint(15000),
MaxConn: uint(200), MaxConn: uint(200),
RequestCondition: "",
SSLCheckCert: true, SSLCheckCert: true,
SSLHostname: "", SSLHostname: "",
Shield: "New York", Shield: "New York",
@ -87,6 +88,7 @@ func TestResourceFastlyFlattenBackend(t *testing.T) {
"error_threshold": 0, "error_threshold": 0,
"first_byte_timeout": 15000, "first_byte_timeout": 15000,
"max_conn": 200, "max_conn": 200,
"request_condition": "",
"ssl_check_cert": gofastly.CBool(true), "ssl_check_cert": gofastly.CBool(true),
"ssl_hostname": "", "ssl_hostname": "",
"shield": "New York", "shield": "New York",

View File

@ -174,6 +174,7 @@ Default `1000`
* `max_conn` - (Optional) Maximum number of connections for this Backend. * `max_conn` - (Optional) Maximum number of connections for this Backend.
Default `200`. Default `200`.
* `port` - (Optional) The port number on which the Backend responds. Default `80`. * `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_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. * `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. * `shield` - (Optional) The POP of the shield designated to reduce inbound load.