Fix schema conversion.

This commit is contained in:
Trevor Pounds 2015-10-30 15:45:43 -07:00 committed by clint shryock
parent 91b1d0c23d
commit 4e3d0b5f6c
2 changed files with 22 additions and 6 deletions

View File

@ -333,7 +333,7 @@ func resourceAwsElbRead(d *schema.ResourceData, meta interface{}) error {
d.Set("idle_timeout", lbAttrs.ConnectionSettings.IdleTimeout)
d.Set("connection_draining", lbAttrs.ConnectionDraining.Enabled)
d.Set("connection_draining_timeout", lbAttrs.ConnectionDraining.Timeout)
d.Set("access_logs", lbAttrs.AccessLog)
d.Set("access_logs", flattenAccessLog(lbAttrs.AccessLog))
resp, err := elbconn.DescribeTags(&elb.DescribeTagsInput{
LoadBalancerNames: []*string{lb.LoadBalancerName},

View File

@ -234,6 +234,22 @@ func expandElastiCacheParameters(configured []interface{}) ([]*elasticache.Param
return parameters, nil
}
// Flattens an access log into something that flatmap.Flatten() can handle
func flattenAccessLog(log *elb.AccessLog) []map[string]interface{} {
result := make([]map[string]interface{}, 0, 1)
if log != nil {
result = append(result, map[string]interface{}{
"enabled": *log.Enabled,
"interval": *log.EmitInterval,
"bucket": *log.S3BucketName,
"bucket_prefix": *log.S3BucketPrefix,
})
}
return result
}
// Flattens a health check into something that flatmap.Flatten()
// can handle
func flattenHealthCheck(check *elb.HealthCheck) []map[string]interface{} {