Merge branch 'zimbatm-fastly-improvements'
This commit is contained in:
commit
68266d5c54
|
@ -172,6 +172,12 @@ func resourceServiceV1() *schema.Resource {
|
|||
Default: true,
|
||||
Description: "Be strict on checking SSL certs",
|
||||
},
|
||||
"ssl_hostname": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Default: "",
|
||||
Description: "SSL certificate hostname",
|
||||
},
|
||||
// UseSSL is something we want to support in the future, but
|
||||
// requires SSL setup we don't yet have
|
||||
// TODO: Provide all SSL fields from https://docs.fastly.com/api/config#backend
|
||||
|
@ -810,8 +816,9 @@ func resourceServiceV1Update(d *schema.ResourceData, meta interface{}) error {
|
|||
Version: latestVersion,
|
||||
Name: df["name"].(string),
|
||||
Address: df["address"].(string),
|
||||
AutoLoadbalance: df["auto_loadbalance"].(bool),
|
||||
SSLCheckCert: df["ssl_check_cert"].(bool),
|
||||
AutoLoadbalance: gofastly.CBool(df["auto_loadbalance"].(bool)),
|
||||
SSLCheckCert: gofastly.CBool(df["ssl_check_cert"].(bool)),
|
||||
SSLHostname: df["ssl_hostname"].(string),
|
||||
Port: uint(df["port"].(int)),
|
||||
BetweenBytesTimeout: uint(df["between_bytes_timeout"].(int)),
|
||||
ConnectTimeout: uint(df["connect_timeout"].(int)),
|
||||
|
@ -1485,14 +1492,15 @@ func flattenBackends(backendList []*gofastly.Backend) []map[string]interface{} {
|
|||
nb := map[string]interface{}{
|
||||
"name": b.Name,
|
||||
"address": b.Address,
|
||||
"auto_loadbalance": b.AutoLoadbalance,
|
||||
"auto_loadbalance": gofastly.CBool(b.AutoLoadbalance),
|
||||
"between_bytes_timeout": int(b.BetweenBytesTimeout),
|
||||
"connect_timeout": int(b.ConnectTimeout),
|
||||
"error_threshold": int(b.ErrorThreshold),
|
||||
"first_byte_timeout": int(b.FirstByteTimeout),
|
||||
"max_conn": int(b.MaxConn),
|
||||
"port": int(b.Port),
|
||||
"ssl_check_cert": b.SSLCheckCert,
|
||||
"ssl_check_cert": gofastly.CBool(b.SSLCheckCert),
|
||||
"ssl_hostname": b.SSLHostname,
|
||||
"weight": int(b.Weight),
|
||||
}
|
||||
|
||||
|
@ -1566,7 +1574,7 @@ func buildHeader(headerMap interface{}) (*gofastly.CreateHeaderInput, error) {
|
|||
df := headerMap.(map[string]interface{})
|
||||
opts := gofastly.CreateHeaderInput{
|
||||
Name: df["name"].(string),
|
||||
IgnoreIfSet: gofastly.Compatibool(df["ignore_if_set"].(bool)),
|
||||
IgnoreIfSet: gofastly.CBool(df["ignore_if_set"].(bool)),
|
||||
Destination: df["destination"].(string),
|
||||
Priority: uint(df["priority"].(int)),
|
||||
Source: df["source"].(string),
|
||||
|
@ -1762,12 +1770,12 @@ func buildRequestSetting(requestSettingMap interface{}) (*gofastly.CreateRequest
|
|||
opts := gofastly.CreateRequestSettingInput{
|
||||
Name: df["name"].(string),
|
||||
MaxStaleAge: uint(df["max_stale_age"].(int)),
|
||||
ForceMiss: gofastly.Compatibool(df["force_miss"].(bool)),
|
||||
ForceSSL: gofastly.Compatibool(df["force_ssl"].(bool)),
|
||||
BypassBusyWait: gofastly.Compatibool(df["bypass_busy_wait"].(bool)),
|
||||
ForceMiss: gofastly.CBool(df["force_miss"].(bool)),
|
||||
ForceSSL: gofastly.CBool(df["force_ssl"].(bool)),
|
||||
BypassBusyWait: gofastly.CBool(df["bypass_busy_wait"].(bool)),
|
||||
HashKeys: df["hash_keys"].(string),
|
||||
TimerSupport: gofastly.Compatibool(df["timer_support"].(bool)),
|
||||
GeoHeaders: gofastly.Compatibool(df["geo_headers"].(bool)),
|
||||
TimerSupport: gofastly.CBool(df["timer_support"].(bool)),
|
||||
GeoHeaders: gofastly.CBool(df["geo_headers"].(bool)),
|
||||
DefaultHost: df["default_host"].(string),
|
||||
RequestCondition: df["request_condition"].(string),
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ func TestFastlyServiceV1_BuildHeaders(t *testing.T) {
|
|||
remote: &gofastly.CreateHeaderInput{
|
||||
Name: "someheadder",
|
||||
Action: gofastly.HeaderActionDelete,
|
||||
IgnoreIfSet: true,
|
||||
IgnoreIfSet: gofastly.CBool(true),
|
||||
Type: gofastly.HeaderTypeCache,
|
||||
Destination: "http.aws-id",
|
||||
Priority: uint(100),
|
||||
|
@ -45,6 +45,7 @@ func TestFastlyServiceV1_BuildHeaders(t *testing.T) {
|
|||
remote: &gofastly.CreateHeaderInput{
|
||||
Name: "someheadder",
|
||||
Action: gofastly.HeaderActionSet,
|
||||
IgnoreIfSet: gofastly.CBool(false),
|
||||
Type: gofastly.HeaderTypeCache,
|
||||
Destination: "http.aws-id",
|
||||
Priority: uint(100),
|
||||
|
|
|
@ -71,6 +71,7 @@ func TestResourceFastlyFlattenBackend(t *testing.T) {
|
|||
FirstByteTimeout: uint(15000),
|
||||
MaxConn: uint(200),
|
||||
SSLCheckCert: true,
|
||||
SSLHostname: "",
|
||||
Weight: uint(100),
|
||||
},
|
||||
},
|
||||
|
@ -79,13 +80,14 @@ func TestResourceFastlyFlattenBackend(t *testing.T) {
|
|||
"name": "test.notexample.com",
|
||||
"address": "www.notexample.com",
|
||||
"port": 80,
|
||||
"auto_loadbalance": true,
|
||||
"auto_loadbalance": gofastly.CBool(true),
|
||||
"between_bytes_timeout": 10000,
|
||||
"connect_timeout": 1000,
|
||||
"error_threshold": 0,
|
||||
"first_byte_timeout": 15000,
|
||||
"max_conn": 200,
|
||||
"ssl_check_cert": true,
|
||||
"ssl_check_cert": gofastly.CBool(true),
|
||||
"ssl_hostname": "",
|
||||
"weight": 100,
|
||||
},
|
||||
},
|
||||
|
|
|
@ -23,6 +23,7 @@ type Backend struct {
|
|||
RequestCondition string `mapstructure:"request_condition"`
|
||||
HealthCheck string `mapstructure:"healthcheck"`
|
||||
Hostname string `mapstructure:"hostname"`
|
||||
Shield string `mapstructure:"shield"`
|
||||
UseSSL bool `mapstructure:"use_ssl"`
|
||||
SSLCheckCert bool `mapstructure:"ssl_check_cert"`
|
||||
SSLHostname string `mapstructure:"ssl_hostname"`
|
||||
|
@ -91,12 +92,13 @@ type CreateBackendInput struct {
|
|||
ErrorThreshold uint `form:"error_threshold,omitempty"`
|
||||
FirstByteTimeout uint `form:"first_byte_timeout,omitempty"`
|
||||
BetweenBytesTimeout uint `form:"between_bytes_timeout,omitempty"`
|
||||
AutoLoadbalance bool `form:"auto_loadbalance,omitempty"`
|
||||
AutoLoadbalance *Compatibool `form:"auto_loadbalance,omitempty"`
|
||||
Weight uint `form:"weight,omitempty"`
|
||||
RequestCondition string `form:"request_condition,omitempty"`
|
||||
HealthCheck string `form:"healthcheck,omitempty"`
|
||||
UseSSL bool `form:"use_ssl,omitempty"`
|
||||
SSLCheckCert bool `form:"ssl_check_cert,omitempty"`
|
||||
Shield string `form:"shield,omitempty"`
|
||||
UseSSL *Compatibool `form:"use_ssl,omitempty"`
|
||||
SSLCheckCert *Compatibool `form:"ssl_check_cert,omitempty"`
|
||||
SSLHostname string `form:"ssl_hostname,omitempty"`
|
||||
SSLCertHostname string `form:"ssl_cert_hostname,omitempty"`
|
||||
SSLSNIHostname string `form:"ssl_sni_hostname,omitempty"`
|
||||
|
@ -184,12 +186,13 @@ type UpdateBackendInput struct {
|
|||
ErrorThreshold uint `form:"error_threshold,omitempty"`
|
||||
FirstByteTimeout uint `form:"first_byte_timeout,omitempty"`
|
||||
BetweenBytesTimeout uint `form:"between_bytes_timeout,omitempty"`
|
||||
AutoLoadbalance bool `form:"auto_loadbalance,omitempty"`
|
||||
AutoLoadbalance *Compatibool `form:"auto_loadbalance,omitempty"`
|
||||
Weight uint `form:"weight,omitempty"`
|
||||
RequestCondition string `form:"request_condition,omitempty"`
|
||||
HealthCheck string `form:"healthcheck,omitempty"`
|
||||
UseSSL bool `form:"use_ssl,omitempty"`
|
||||
SSLCheckCert bool `form:"ssl_check_cert,omitempty"`
|
||||
Shield string `form:"shield,omitempty"`
|
||||
UseSSL *Compatibool `form:"use_ssl,omitempty"`
|
||||
SSLCheckCert *Compatibool `form:"ssl_check_cert,omitempty"`
|
||||
SSLHostname string `form:"ssl_hostname,omitempty"`
|
||||
SSLCertHostname string `form:"ssl_cert_hostname,omitempty"`
|
||||
SSLSNIHostname string `form:"ssl_sni_hostname,omitempty"`
|
||||
|
|
|
@ -195,10 +195,11 @@ func (c *Client) DeleteDictionary(i *DeleteDictionaryInput) error {
|
|||
}
|
||||
|
||||
path := fmt.Sprintf("/service/%s/version/%s/dictionary/%s", i.Service, i.Version, i.Name)
|
||||
_, err := c.Delete(path, nil)
|
||||
resp, err := c.Delete(path, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
// Unlike other endpoints, the dictionary endpoint does not return a status
|
||||
// response - it just returns a 200 OK.
|
||||
|
|
|
@ -196,10 +196,11 @@ func (c *Client) DeleteDictionaryItem(i *DeleteDictionaryItemInput) error {
|
|||
}
|
||||
|
||||
path := fmt.Sprintf("/service/%s/dictionary/%s/item/%s", i.Service, i.Dictionary, i.ItemKey)
|
||||
_, err := c.Delete(path, nil)
|
||||
resp, err := c.Delete(path, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
// Unlike other endpoints, the dictionary endpoint does not return a status
|
||||
// response - it just returns a 200 OK.
|
||||
|
|
|
@ -20,6 +20,12 @@ var (
|
|||
_ encoding.TextUnmarshaler = new(Compatibool)
|
||||
)
|
||||
|
||||
// Helper function to get a pointer to bool
|
||||
func CBool(b bool) *Compatibool {
|
||||
c := Compatibool(b)
|
||||
return &c
|
||||
}
|
||||
|
||||
// Compatibool is a boolean value that marshalls to 0/1 instead of true/false
|
||||
// for compatability with Fastly's API.
|
||||
type Compatibool bool
|
||||
|
|
|
@ -119,7 +119,7 @@ type CreateHeaderInput struct {
|
|||
|
||||
Name string `form:"name,omitempty"`
|
||||
Action HeaderAction `form:"action,omitempty"`
|
||||
IgnoreIfSet Compatibool `form:"ignore_if_set,omitempty"`
|
||||
IgnoreIfSet *Compatibool `form:"ignore_if_set,omitempty"`
|
||||
Type HeaderType `form:"type,omitempty"`
|
||||
Destination string `form:"dst,omitempty"`
|
||||
Source string `form:"src,omitempty"`
|
||||
|
@ -204,7 +204,7 @@ type UpdateHeaderInput struct {
|
|||
|
||||
NewName string `form:"name,omitempty"`
|
||||
Action HeaderAction `form:"action,omitempty"`
|
||||
IgnoreIfSet Compatibool `form:"ignore_if_set,omitempty"`
|
||||
IgnoreIfSet *Compatibool `form:"ignore_if_set,omitempty"`
|
||||
Type HeaderType `form:"type,omitempty"`
|
||||
Destination string `form:"dst,omitempty"`
|
||||
Source string `form:"src,omitempty"`
|
||||
|
|
|
@ -74,7 +74,7 @@ type CreateLogentriesInput struct {
|
|||
|
||||
Name string `form:"name,omitempty"`
|
||||
Port uint `form:"port,omitempty"`
|
||||
UseTLS Compatibool `form:"use_tls,omitempty"`
|
||||
UseTLS *Compatibool `form:"use_tls,omitempty"`
|
||||
Token string `form:"token,omitempty"`
|
||||
Format string `form:"format,omitempty"`
|
||||
ResponseCondition string `form:"response_condition,omitempty"`
|
||||
|
@ -153,7 +153,7 @@ type UpdateLogentriesInput struct {
|
|||
|
||||
NewName string `form:"name,omitempty"`
|
||||
Port uint `form:"port,omitempty"`
|
||||
UseTLS Compatibool `form:"use_tls,omitempty"`
|
||||
UseTLS *Compatibool `form:"use_tls,omitempty"`
|
||||
Token string `form:"token,omitempty"`
|
||||
Format string `form:"format,omitempty"`
|
||||
ResponseCondition string `form:"response_condition,omitempty"`
|
||||
|
|
|
@ -110,15 +110,15 @@ type CreateRequestSettingInput struct {
|
|||
Version string
|
||||
|
||||
Name string `form:"name,omitempty"`
|
||||
ForceMiss Compatibool `form:"force_miss,omitempty"`
|
||||
ForceSSL Compatibool `form:"force_ssl,omitempty"`
|
||||
ForceMiss *Compatibool `form:"force_miss,omitempty"`
|
||||
ForceSSL *Compatibool `form:"force_ssl,omitempty"`
|
||||
Action RequestSettingAction `form:"action,omitempty"`
|
||||
BypassBusyWait Compatibool `form:"bypass_busy_wait,omitempty"`
|
||||
BypassBusyWait *Compatibool `form:"bypass_busy_wait,omitempty"`
|
||||
MaxStaleAge uint `form:"max_stale_age,omitempty"`
|
||||
HashKeys string `form:"hash_keys,omitempty"`
|
||||
XForwardedFor RequestSettingXFF `form:"xff,omitempty"`
|
||||
TimerSupport Compatibool `form:"timer_support,omitempty"`
|
||||
GeoHeaders Compatibool `form:"geo_headers,omitempty"`
|
||||
TimerSupport *Compatibool `form:"timer_support,omitempty"`
|
||||
GeoHeaders *Compatibool `form:"geo_headers,omitempty"`
|
||||
DefaultHost string `form:"default_host,omitempty"`
|
||||
RequestCondition string `form:"request_condition,omitempty"`
|
||||
}
|
||||
|
@ -197,15 +197,15 @@ type UpdateRequestSettingInput struct {
|
|||
Name string
|
||||
|
||||
NewName string `form:"name,omitempty"`
|
||||
ForceMiss Compatibool `form:"force_miss,omitempty"`
|
||||
ForceSSL Compatibool `form:"force_ssl,omitempty"`
|
||||
ForceMiss *Compatibool `form:"force_miss,omitempty"`
|
||||
ForceSSL *Compatibool `form:"force_ssl,omitempty"`
|
||||
Action RequestSettingAction `form:"action,omitempty"`
|
||||
BypassBusyWait Compatibool `form:"bypass_busy_wait,omitempty"`
|
||||
BypassBusyWait *Compatibool `form:"bypass_busy_wait,omitempty"`
|
||||
MaxStaleAge uint `form:"max_stale_age,omitempty"`
|
||||
HashKeys string `form:"hash_keys,omitempty"`
|
||||
XForwardedFor RequestSettingXFF `form:"xff,omitempty"`
|
||||
TimerSupport Compatibool `form:"timer_support,omitempty"`
|
||||
GeoHeaders Compatibool `form:"geo_headers,omitempty"`
|
||||
TimerSupport *Compatibool `form:"timer_support,omitempty"`
|
||||
GeoHeaders *Compatibool `form:"geo_headers,omitempty"`
|
||||
DefaultHost string `form:"default_host,omitempty"`
|
||||
RequestCondition string `form:"request_condition,omitempty"`
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ type CreateSyslogInput struct {
|
|||
Name string `form:"name,omitempty"`
|
||||
Address string `form:"address,omitempty"`
|
||||
Port uint `form:"port,omitempty"`
|
||||
UseTLS Compatibool `form:"use_tls,omitempty"`
|
||||
UseTLS *Compatibool `form:"use_tls,omitempty"`
|
||||
TLSCACert string `form:"tls_ca_cert,omitempty"`
|
||||
Token string `form:"token,omitempty"`
|
||||
Format string `form:"format,omitempty"`
|
||||
|
@ -158,7 +158,7 @@ type UpdateSyslogInput struct {
|
|||
NewName string `form:"name,omitempty"`
|
||||
Address string `form:"address,omitempty"`
|
||||
Port uint `form:"port,omitempty"`
|
||||
UseTLS Compatibool `form:"use_tls,omitempty"`
|
||||
UseTLS *Compatibool `form:"use_tls,omitempty"`
|
||||
TLSCACert string `form:"tls_ca_cert,omitempty"`
|
||||
Token string `form:"token,omitempty"`
|
||||
Format string `form:"format,omitempty"`
|
||||
|
|
|
@ -2194,10 +2194,10 @@
|
|||
"revisionTime": "2016-10-27T15:40:24Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "DWJoWDXcRi4HUCyxU6dLVVjR4pI=",
|
||||
"checksumSHA1": "BqtlwAjgFuHsVVdnw+dGSe+CKLM=",
|
||||
"path": "github.com/sethvargo/go-fastly",
|
||||
"revision": "b0a18d43769d55365d4fbd9ba36493e5c0dcd8f5",
|
||||
"revisionTime": "2016-07-08T18:18:56Z"
|
||||
"revision": "2f6c4b7ec89b1e3ece8e770af7b2b546c5a048de",
|
||||
"revisionTime": "2016-10-26T14:57:03Z"
|
||||
},
|
||||
{
|
||||
"comment": "v1.1-2-g5578a8c",
|
||||
|
|
|
@ -175,6 +175,7 @@ Default `1000`
|
|||
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.
|
||||
* `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
|
||||
|
|
Loading…
Reference in New Issue