Enable/Disbale Option For ELB Access logs

This commit is contained in:
Anshul Sharma 2016-08-24 14:37:47 +05:30
parent 70cc108614
commit f034638026
2 changed files with 10 additions and 1 deletions

View File

@ -127,6 +127,11 @@ func resourceAwsElb() *schema.Resource {
Type: schema.TypeString, Type: schema.TypeString,
Optional: true, 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 { } else if len(logs) == 1 {
log := logs[0].(map[string]interface{}) log := logs[0].(map[string]interface{})
accessLog := &elb.AccessLog{ accessLog := &elb.AccessLog{
Enabled: aws.Bool(true), 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)),
} }

View File

@ -374,6 +374,10 @@ func flattenAccessLog(l *elb.AccessLog) []map[string]interface{} {
r["interval"] = *l.EmitInterval r["interval"] = *l.EmitInterval
} }
if l.Enabled != nil {
r["enabled"] = *l.Enabled
}
result = append(result, r) result = append(result, r)
} }