go fmt after rebase
This commit is contained in:
parent
4e3d0b5f6c
commit
2e03a7ebff
|
@ -101,35 +101,35 @@ func resourceAwsElb() *schema.Resource {
|
||||||
Default: 300,
|
Default: 300,
|
||||||
},
|
},
|
||||||
|
|
||||||
"access_logs": &schema.Schema{
|
"access_logs": &schema.Schema{
|
||||||
Type: schema.TypeSet,
|
Type: schema.TypeSet,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
Elem: &schema.Resource{
|
Elem: &schema.Resource{
|
||||||
Schema: map[string]*schema.Schema{
|
Schema: map[string]*schema.Schema{
|
||||||
"enabled": &schema.Schema{
|
"enabled": &schema.Schema{
|
||||||
Type: schema.TypeBool,
|
Type: schema.TypeBool,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
Default: true,
|
Default: true,
|
||||||
},
|
},
|
||||||
"interval": &schema.Schema{
|
"interval": &schema.Schema{
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
Default: 60,
|
Default: 60,
|
||||||
},
|
},
|
||||||
"bucket": &schema.Schema{
|
"bucket": &schema.Schema{
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Required: true,
|
Required: true,
|
||||||
},
|
},
|
||||||
"bucket_prefix": &schema.Schema{
|
"bucket_prefix": &schema.Schema{
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Set: resourceAwsElbAccessLogsHash,
|
Set: resourceAwsElbAccessLogsHash,
|
||||||
},
|
},
|
||||||
|
|
||||||
"listener": &schema.Schema{
|
"listener": &schema.Schema{
|
||||||
Type: schema.TypeSet,
|
Type: schema.TypeSet,
|
||||||
Required: true,
|
Required: true,
|
||||||
Elem: &schema.Resource{
|
Elem: &schema.Resource{
|
||||||
|
@ -330,13 +330,13 @@ func resourceAwsElbRead(d *schema.ResourceData, meta interface{}) error {
|
||||||
d.Set("source_security_group", lb.SourceSecurityGroup.GroupName)
|
d.Set("source_security_group", lb.SourceSecurityGroup.GroupName)
|
||||||
}
|
}
|
||||||
d.Set("subnets", lb.Subnets)
|
d.Set("subnets", lb.Subnets)
|
||||||
d.Set("idle_timeout", lbAttrs.ConnectionSettings.IdleTimeout)
|
d.Set("idle_timeout", lbAttrs.ConnectionSettings.IdleTimeout)
|
||||||
d.Set("connection_draining", lbAttrs.ConnectionDraining.Enabled)
|
d.Set("connection_draining", lbAttrs.ConnectionDraining.Enabled)
|
||||||
d.Set("connection_draining_timeout", lbAttrs.ConnectionDraining.Timeout)
|
d.Set("connection_draining_timeout", lbAttrs.ConnectionDraining.Timeout)
|
||||||
d.Set("access_logs", flattenAccessLog(lbAttrs.AccessLog))
|
d.Set("access_logs", flattenAccessLog(lbAttrs.AccessLog))
|
||||||
|
|
||||||
resp, err := elbconn.DescribeTags(&elb.DescribeTagsInput{
|
resp, err := elbconn.DescribeTags(&elb.DescribeTagsInput{
|
||||||
LoadBalancerNames: []*string{lb.LoadBalancerName},
|
LoadBalancerNames: []*string{lb.LoadBalancerName},
|
||||||
})
|
})
|
||||||
|
|
||||||
var et []*elb.Tag
|
var et []*elb.Tag
|
||||||
|
@ -434,7 +434,7 @@ func resourceAwsElbUpdate(d *schema.ResourceData, meta interface{}) error {
|
||||||
d.SetPartial("instances")
|
d.SetPartial("instances")
|
||||||
}
|
}
|
||||||
|
|
||||||
if d.HasChange("cross_zone_load_balancing") || d.HasChange("idle_timeout") || d.HasChange("access_logs") {
|
if d.HasChange("cross_zone_load_balancing") || d.HasChange("idle_timeout") || d.HasChange("access_logs") {
|
||||||
attrs := elb.ModifyLoadBalancerAttributesInput{
|
attrs := elb.ModifyLoadBalancerAttributesInput{
|
||||||
LoadBalancerName: aws.String(d.Get("name").(string)),
|
LoadBalancerName: aws.String(d.Get("name").(string)),
|
||||||
LoadBalancerAttributes: &elb.LoadBalancerAttributes{
|
LoadBalancerAttributes: &elb.LoadBalancerAttributes{
|
||||||
|
@ -445,25 +445,25 @@ func resourceAwsElbUpdate(d *schema.ResourceData, meta interface{}) error {
|
||||||
IdleTimeout: aws.Int64(int64(d.Get("idle_timeout").(int))),
|
IdleTimeout: aws.Int64(int64(d.Get("idle_timeout").(int))),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
logs := d.Get("access_logs").(*schema.Set).List()
|
logs := d.Get("access_logs").(*schema.Set).List()
|
||||||
if len(logs) > 1 {
|
if len(logs) > 1 {
|
||||||
return fmt.Errorf("Only one access logs config per ELB is supported")
|
return fmt.Errorf("Only one access logs config per ELB is supported")
|
||||||
} else if len(logs) == 1 {
|
} else if len(logs) == 1 {
|
||||||
log := logs[0].(map[string]interface{})
|
log := logs[0].(map[string]interface{})
|
||||||
accessLogs := &elb.AccessLog{
|
accessLogs := &elb.AccessLog{
|
||||||
Enabled: aws.Bool(log["enabled"].(bool)),
|
Enabled: aws.Bool(log["enabled"].(bool)),
|
||||||
EmitInterval: aws.Int64(int64(log["interval"].(int))),
|
EmitInterval: aws.Int64(int64(log["interval"].(int))),
|
||||||
S3BucketName: aws.String(log["bucket"].(string)),
|
S3BucketName: aws.String(log["bucket"].(string)),
|
||||||
}
|
}
|
||||||
|
|
||||||
if log["bucket_prefix"] != "" {
|
if log["bucket_prefix"] != "" {
|
||||||
accessLogs.S3BucketPrefix = aws.String(log["bucket_prefix"].(string))
|
accessLogs.S3BucketPrefix = aws.String(log["bucket_prefix"].(string))
|
||||||
}
|
}
|
||||||
|
|
||||||
attrs.LoadBalancerAttributes.AccessLog = accessLogs
|
attrs.LoadBalancerAttributes.AccessLog = accessLogs
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err := elbconn.ModifyLoadBalancerAttributes(&attrs)
|
_, err := elbconn.ModifyLoadBalancerAttributes(&attrs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -598,17 +598,17 @@ func resourceAwsElbHealthCheckHash(v interface{}) int {
|
||||||
}
|
}
|
||||||
|
|
||||||
func resourceAwsElbAccessLogsHash(v interface{}) int {
|
func resourceAwsElbAccessLogsHash(v interface{}) int {
|
||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
m := v.(map[string]interface{})
|
m := v.(map[string]interface{})
|
||||||
buf.WriteString(fmt.Sprintf("%t-", m["enabled"].(bool)))
|
buf.WriteString(fmt.Sprintf("%t-", m["enabled"].(bool)))
|
||||||
buf.WriteString(fmt.Sprintf("%d-", m["interval"].(int)))
|
buf.WriteString(fmt.Sprintf("%d-", m["interval"].(int)))
|
||||||
buf.WriteString(fmt.Sprintf("%s-",
|
buf.WriteString(fmt.Sprintf("%s-",
|
||||||
strings.ToLower(m["bucket"].(string))))
|
strings.ToLower(m["bucket"].(string))))
|
||||||
if v, ok := m["bucket_prefix"]; ok {
|
if v, ok := m["bucket_prefix"]; ok {
|
||||||
buf.WriteString(fmt.Sprintf("%s-", strings.ToLower(v.(string))))
|
buf.WriteString(fmt.Sprintf("%s-", strings.ToLower(v.(string))))
|
||||||
}
|
}
|
||||||
|
|
||||||
return hashcode.String(buf.String())
|
return hashcode.String(buf.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
func resourceAwsElbListenerHash(v interface{}) int {
|
func resourceAwsElbListenerHash(v interface{}) int {
|
||||||
|
|
|
@ -236,18 +236,18 @@ func expandElastiCacheParameters(configured []interface{}) ([]*elasticache.Param
|
||||||
|
|
||||||
// Flattens an access log into something that flatmap.Flatten() can handle
|
// Flattens an access log into something that flatmap.Flatten() can handle
|
||||||
func flattenAccessLog(log *elb.AccessLog) []map[string]interface{} {
|
func flattenAccessLog(log *elb.AccessLog) []map[string]interface{} {
|
||||||
result := make([]map[string]interface{}, 0, 1)
|
result := make([]map[string]interface{}, 0, 1)
|
||||||
|
|
||||||
if log != nil {
|
if log != nil {
|
||||||
result = append(result, map[string]interface{}{
|
result = append(result, map[string]interface{}{
|
||||||
"enabled": *log.Enabled,
|
"enabled": *log.Enabled,
|
||||||
"interval": *log.EmitInterval,
|
"interval": *log.EmitInterval,
|
||||||
"bucket": *log.S3BucketName,
|
"bucket": *log.S3BucketName,
|
||||||
"bucket_prefix": *log.S3BucketPrefix,
|
"bucket_prefix": *log.S3BucketPrefix,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flattens a health check into something that flatmap.Flatten()
|
// Flattens a health check into something that flatmap.Flatten()
|
||||||
|
|
Loading…
Reference in New Issue