provider/fastly add origin shielding (#10677)

* Add shield to options for fastly backend

* Add shield to acceptance test for fastly

* Update website with shield option
This commit is contained in:
Traver Tischio 2016-12-12 17:17:35 -05:00 committed by Paul Stack
parent 3173b7c17b
commit 27d42d1831
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",
}, },
"shield": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Default: "",
Description: "The POP of the shield designated to reduce inbound load.",
},
"ssl_check_cert": &schema.Schema{ "ssl_check_cert": &schema.Schema{
Type: schema.TypeBool, Type: schema.TypeBool,
Optional: true, Optional: true,
@ -819,6 +825,7 @@ func resourceServiceV1Update(d *schema.ResourceData, meta interface{}) error {
AutoLoadbalance: gofastly.CBool(df["auto_loadbalance"].(bool)), AutoLoadbalance: gofastly.CBool(df["auto_loadbalance"].(bool)),
SSLCheckCert: gofastly.CBool(df["ssl_check_cert"].(bool)), SSLCheckCert: gofastly.CBool(df["ssl_check_cert"].(bool)),
SSLHostname: df["ssl_hostname"].(string), SSLHostname: df["ssl_hostname"].(string),
Shield: df["shield"].(string),
Port: uint(df["port"].(int)), Port: uint(df["port"].(int)),
BetweenBytesTimeout: uint(df["between_bytes_timeout"].(int)), BetweenBytesTimeout: uint(df["between_bytes_timeout"].(int)),
ConnectTimeout: uint(df["connect_timeout"].(int)), ConnectTimeout: uint(df["connect_timeout"].(int)),
@ -1499,6 +1506,7 @@ func flattenBackends(backendList []*gofastly.Backend) []map[string]interface{} {
"first_byte_timeout": int(b.FirstByteTimeout), "first_byte_timeout": int(b.FirstByteTimeout),
"max_conn": int(b.MaxConn), "max_conn": int(b.MaxConn),
"port": int(b.Port), "port": int(b.Port),
"shield": b.Shield,
"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),

View File

@ -72,6 +72,7 @@ func TestResourceFastlyFlattenBackend(t *testing.T) {
MaxConn: uint(200), MaxConn: uint(200),
SSLCheckCert: true, SSLCheckCert: true,
SSLHostname: "", SSLHostname: "",
Shield: "New York",
Weight: uint(100), Weight: uint(100),
}, },
}, },
@ -88,6 +89,7 @@ func TestResourceFastlyFlattenBackend(t *testing.T) {
"max_conn": 200, "max_conn": 200,
"ssl_check_cert": gofastly.CBool(true), "ssl_check_cert": gofastly.CBool(true),
"ssl_hostname": "", "ssl_hostname": "",
"shield": "New York",
"weight": 100, "weight": 100,
}, },
}, },

View File

@ -176,6 +176,7 @@ 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`.
* `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.
* `weight` - (Optional) The [portion of traffic](https://docs.fastly.com/guides/performance-tuning/load-balancing-configuration.html#how-weight-affects-load-balancing) to send to this Backend. Each Backend receives `weight / total` of the traffic. Default `100`. * `weight` - (Optional) The [portion of traffic](https://docs.fastly.com/guides/performance-tuning/load-balancing-configuration.html#how-weight-affects-load-balancing) to send to this Backend. Each Backend receives `weight / total` of the traffic. Default `100`.
The `condition` block supports allows you to add logic to any basic configuration The `condition` block supports allows you to add logic to any basic configuration