Merge branch 'master' of https://github.com/jvasallo/terraform into jvasallo-master

This commit is contained in:
stack72 2016-10-27 11:00:48 +01:00
commit 54cca9b4fb
No known key found for this signature in database
GPG Key ID: 8619A619B085CB16
3 changed files with 11 additions and 1 deletions

View File

@ -88,6 +88,11 @@ func resourceAwsAlb() *schema.Resource {
Type: schema.TypeString,
Optional: true,
},
"enabled": &schema.Schema{
Type: schema.TypeBool,
Optional: true,
Default: true,
},
},
},
},
@ -229,6 +234,8 @@ func resourceAwsAlbRead(d *schema.ResourceData, meta interface{}) error {
accessLogMap := map[string]interface{}{}
for _, attr := range attributesResp.Attributes {
switch *attr.Key {
case "access_logs.s3.enabled":
accessLogMap["enabled"] = *attr.Value
case "access_logs.s3.bucket":
accessLogMap["bucket"] = *attr.Value
case "access_logs.s3.prefix":
@ -276,7 +283,7 @@ func resourceAwsAlbUpdate(d *schema.ResourceData, meta interface{}) error {
attributes = append(attributes,
&elbv2.LoadBalancerAttribute{
Key: aws.String("access_logs.s3.enabled"),
Value: aws.String("true"),
Value: aws.String(strconv.FormatBool(log["enabled"].(bool))),
},
&elbv2.LoadBalancerAttribute{
Key: aws.String("access_logs.s3.bucket"),

View File

@ -232,6 +232,7 @@ func TestAccAWSALB_accesslogs(t *testing.T) {
resource.TestCheckResourceAttr("aws_alb.alb_test", "access_logs.#", "1"),
resource.TestCheckResourceAttr("aws_alb.alb_test", "access_logs.0.bucket", bucketName),
resource.TestCheckResourceAttr("aws_alb.alb_test", "access_logs.0.prefix", "testAccAWSALBConfig_accessLogs"),
resource.TestCheckResourceAttr("aws_alb.alb_test", "access_logs.0.enabled", "true"),
resource.TestCheckResourceAttrSet("aws_alb.alb_test", "arn"),
),
},
@ -582,6 +583,7 @@ func testAccAWSALBConfig_accessLogs(albName, bucketName string) string {
access_logs {
bucket = "${aws_s3_bucket.logs.bucket}"
prefix = "${var.bucket_prefix}"
enabled = "${var.enabled}"
}
tags {

View File

@ -54,6 +54,7 @@ Access Logs (`access_logs`) support the following:
* `bucket` - (Required) The S3 bucket name to store the logs in.
* `prefix` - (Optional) The S3 bucket prefix. Logs are stored in the root if not configured.
* `enabled` = (Optional) Boolean to enable / disable `access_logs`. Default is `true`
## Attributes Reference