From 27d42d1831eaa9f1ac93328838e7a57fe69b1751 Mon Sep 17 00:00:00 2001 From: Traver Tischio Date: Mon, 12 Dec 2016 17:17:35 -0500 Subject: [PATCH] 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 --- builtin/providers/fastly/resource_fastly_service_v1.go | 8 ++++++++ .../providers/fastly/resource_fastly_service_v1_test.go | 2 ++ .../docs/providers/fastly/r/service_v1.html.markdown | 1 + 3 files changed, 11 insertions(+) diff --git a/builtin/providers/fastly/resource_fastly_service_v1.go b/builtin/providers/fastly/resource_fastly_service_v1.go index 1c7f61a26..afa104aca 100644 --- a/builtin/providers/fastly/resource_fastly_service_v1.go +++ b/builtin/providers/fastly/resource_fastly_service_v1.go @@ -166,6 +166,12 @@ func resourceServiceV1() *schema.Resource { 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{ Type: schema.TypeBool, Optional: true, @@ -819,6 +825,7 @@ func resourceServiceV1Update(d *schema.ResourceData, meta interface{}) error { AutoLoadbalance: gofastly.CBool(df["auto_loadbalance"].(bool)), SSLCheckCert: gofastly.CBool(df["ssl_check_cert"].(bool)), SSLHostname: df["ssl_hostname"].(string), + Shield: df["shield"].(string), Port: uint(df["port"].(int)), BetweenBytesTimeout: uint(df["between_bytes_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), "max_conn": int(b.MaxConn), "port": int(b.Port), + "shield": b.Shield, "ssl_check_cert": gofastly.CBool(b.SSLCheckCert), "ssl_hostname": b.SSLHostname, "weight": int(b.Weight), diff --git a/builtin/providers/fastly/resource_fastly_service_v1_test.go b/builtin/providers/fastly/resource_fastly_service_v1_test.go index a777563ec..68cc6faae 100644 --- a/builtin/providers/fastly/resource_fastly_service_v1_test.go +++ b/builtin/providers/fastly/resource_fastly_service_v1_test.go @@ -72,6 +72,7 @@ func TestResourceFastlyFlattenBackend(t *testing.T) { MaxConn: uint(200), SSLCheckCert: true, SSLHostname: "", + Shield: "New York", Weight: uint(100), }, }, @@ -88,6 +89,7 @@ func TestResourceFastlyFlattenBackend(t *testing.T) { "max_conn": 200, "ssl_check_cert": gofastly.CBool(true), "ssl_hostname": "", + "shield": "New York", "weight": 100, }, }, diff --git a/website/source/docs/providers/fastly/r/service_v1.html.markdown b/website/source/docs/providers/fastly/r/service_v1.html.markdown index 76a7479a2..78934ea3a 100644 --- a/website/source/docs/providers/fastly/r/service_v1.html.markdown +++ b/website/source/docs/providers/fastly/r/service_v1.html.markdown @@ -176,6 +176,7 @@ Default `200`. * `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_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`. The `condition` block supports allows you to add logic to any basic configuration