From 7f2244183c199d808480f2619f6a2d40dc6b5465 Mon Sep 17 00:00:00 2001 From: clint shryock Date: Wed, 11 Nov 2015 15:25:24 -0600 Subject: [PATCH] providers/aws: Fix issue with removing access_logs from ELB --- builtin/providers/aws/structure.go | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/builtin/providers/aws/structure.go b/builtin/providers/aws/structure.go index 4cbb35c15..3afebbad7 100644 --- a/builtin/providers/aws/structure.go +++ b/builtin/providers/aws/structure.go @@ -239,24 +239,21 @@ func expandElastiCacheParameters(configured []interface{}) ([]*elasticache.Param } // Flattens an access log into something that flatmap.Flatten() can handle -func flattenAccessLog(log *elb.AccessLog) []map[string]interface{} { +func flattenAccessLog(l *elb.AccessLog) []map[string]interface{} { result := make([]map[string]interface{}, 0, 1) - if log != nil { + if l != nil && *l.Enabled { r := make(map[string]interface{}) - // enabled is the only value we can rely on to not be nil - r["enabled"] = *log.Enabled - - if log.S3BucketName != nil { - r["bucket"] = *log.S3BucketName + if l.S3BucketName != nil { + r["bucket"] = *l.S3BucketName } - if log.S3BucketPrefix != nil { - r["bucket_prefix"] = *log.S3BucketPrefix + if l.S3BucketPrefix != nil { + r["bucket_prefix"] = *l.S3BucketPrefix } - if log.EmitInterval != nil { - r["interval"] = *log.EmitInterval + if l.EmitInterval != nil { + r["interval"] = *l.EmitInterval } result = append(result, r)