Changes per feedback
This commit is contained in:
parent
e390d7ddf2
commit
e173b60f10
|
@ -108,8 +108,8 @@ func resourceAwsElb() *schema.Resource {
|
|||
Schema: map[string]*schema.Schema{
|
||||
"enabled": &schema.Schema{
|
||||
Type: schema.TypeBool,
|
||||
Required: true,
|
||||
Default: false,
|
||||
Optional: true,
|
||||
Default: true,
|
||||
},
|
||||
"interval": &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
|
@ -119,15 +119,14 @@ func resourceAwsElb() *schema.Resource {
|
|||
"bucket": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
Default: "",
|
||||
},
|
||||
"bucket_prefix": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Default: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
Set: resourceAwsElbAccessLogsHash,
|
||||
},
|
||||
|
||||
"listener": &schema.Schema{
|
||||
|
@ -455,8 +454,12 @@ func resourceAwsElbUpdate(d *schema.ResourceData, meta interface{}) error {
|
|||
Enabled: aws.Bool(log["enabled"].(bool)),
|
||||
EmitInterval: aws.Int64(log["interval"].(int64)),
|
||||
S3BucketName: aws.String(log["bucket"].(string)),
|
||||
S3BucketPrefix: aws.String(log["bucket"].(string)),
|
||||
}
|
||||
|
||||
if log["bucket_prefix"] != "" {
|
||||
accessLogs.S3BucketPrefix = aws.String(log["bucket_prefix"].(string))
|
||||
}
|
||||
|
||||
attrs.LoadBalancerAttributes.AccessLog = accessLogs
|
||||
}
|
||||
|
||||
|
@ -592,6 +595,20 @@ func resourceAwsElbHealthCheckHash(v interface{}) int {
|
|||
return hashcode.String(buf.String())
|
||||
}
|
||||
|
||||
func resourceAwsElbAccessLogsHash(v interface{}) int {
|
||||
var buf bytes.Buffer
|
||||
m := v.(map[string]interface{})
|
||||
buf.WriteString(fmt.Sprintf("%t-", m["enabled"].(bool)))
|
||||
buf.WriteString(fmt.Sprintf("%d-", m["interval"].(int)))
|
||||
buf.WriteString(fmt.Sprintf("%s-",
|
||||
strings.ToLower(m["bucket"].(string))))
|
||||
if v, ok := m["bucket_prefix"]; ok {
|
||||
buf.WriteString(fmt.Sprintf("%s-", strings.ToLower(v.(string))))
|
||||
}
|
||||
|
||||
return hashcode.String(buf.String())
|
||||
}
|
||||
|
||||
func resourceAwsElbListenerHash(v interface{}) int {
|
||||
var buf bytes.Buffer
|
||||
m := v.(map[string]interface{})
|
||||
|
|
Loading…
Reference in New Issue