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{
|
Schema: map[string]*schema.Schema{
|
||||||
"enabled": &schema.Schema{
|
"enabled": &schema.Schema{
|
||||||
Type: schema.TypeBool,
|
Type: schema.TypeBool,
|
||||||
Required: true,
|
Optional: true,
|
||||||
Default: false,
|
Default: true,
|
||||||
},
|
},
|
||||||
"interval": &schema.Schema{
|
"interval": &schema.Schema{
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
|
@ -119,18 +119,17 @@ func resourceAwsElb() *schema.Resource {
|
||||||
"bucket": &schema.Schema{
|
"bucket": &schema.Schema{
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Required: true,
|
Required: true,
|
||||||
Default: "",
|
|
||||||
},
|
},
|
||||||
"bucket_prefix": &schema.Schema{
|
"bucket_prefix": &schema.Schema{
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
Default: "",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Set: resourceAwsElbAccessLogsHash,
|
||||||
},
|
},
|
||||||
|
|
||||||
"listener": &schema.Schema{
|
"listener": &schema.Schema{
|
||||||
Type: schema.TypeSet,
|
Type: schema.TypeSet,
|
||||||
Required: true,
|
Required: true,
|
||||||
Elem: &schema.Resource{
|
Elem: &schema.Resource{
|
||||||
|
@ -455,8 +454,12 @@ func resourceAwsElbUpdate(d *schema.ResourceData, meta interface{}) error {
|
||||||
Enabled: aws.Bool(log["enabled"].(bool)),
|
Enabled: aws.Bool(log["enabled"].(bool)),
|
||||||
EmitInterval: aws.Int64(log["interval"].(int64)),
|
EmitInterval: aws.Int64(log["interval"].(int64)),
|
||||||
S3BucketName: aws.String(log["bucket"].(string)),
|
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
|
attrs.LoadBalancerAttributes.AccessLog = accessLogs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -592,6 +595,20 @@ func resourceAwsElbHealthCheckHash(v interface{}) int {
|
||||||
return hashcode.String(buf.String())
|
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 {
|
func resourceAwsElbListenerHash(v interface{}) int {
|
||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
m := v.(map[string]interface{})
|
m := v.(map[string]interface{})
|
||||||
|
|
Loading…
Reference in New Issue