From f03463802676eb0c96dbe1f8ed2d2a4d4257065e Mon Sep 17 00:00:00 2001 From: Anshul Sharma Date: Wed, 24 Aug 2016 14:37:47 +0530 Subject: [PATCH] Enable/Disbale Option For ELB Access logs --- builtin/providers/aws/resource_aws_elb.go | 7 ++++++- builtin/providers/aws/structure.go | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/builtin/providers/aws/resource_aws_elb.go b/builtin/providers/aws/resource_aws_elb.go index e036928dc..79dc5fe7a 100644 --- a/builtin/providers/aws/resource_aws_elb.go +++ b/builtin/providers/aws/resource_aws_elb.go @@ -127,6 +127,11 @@ func resourceAwsElb() *schema.Resource { Type: schema.TypeString, Optional: true, }, + "enabled": &schema.Schema{ + Type: schema.TypeBool, + Optional: true, + Default: true, + }, }, }, }, @@ -520,7 +525,7 @@ func resourceAwsElbUpdate(d *schema.ResourceData, meta interface{}) error { } else if len(logs) == 1 { log := logs[0].(map[string]interface{}) accessLog := &elb.AccessLog{ - Enabled: aws.Bool(true), + Enabled: aws.Bool(log["enabled"].(bool)), EmitInterval: aws.Int64(int64(log["interval"].(int))), S3BucketName: aws.String(log["bucket"].(string)), } diff --git a/builtin/providers/aws/structure.go b/builtin/providers/aws/structure.go index cb3e76a6f..149dade0e 100644 --- a/builtin/providers/aws/structure.go +++ b/builtin/providers/aws/structure.go @@ -374,6 +374,10 @@ func flattenAccessLog(l *elb.AccessLog) []map[string]interface{} { r["interval"] = *l.EmitInterval } + if l.Enabled != nil { + r["enabled"] = *l.Enabled + } + result = append(result, r) }