Fixed alb access_log enabled type to match that of aws-sdk-go

This commit is contained in:
Joel Vasallo 2016-10-07 19:32:19 -05:00
parent a4743eac33
commit e00b2448d8
2 changed files with 4 additions and 2 deletions

View File

@ -281,7 +281,7 @@ func resourceAwsAlbUpdate(d *schema.ResourceData, meta interface{}) error {
attributes = append(attributes, attributes = append(attributes,
&elbv2.LoadBalancerAttribute{ &elbv2.LoadBalancerAttribute{
Key: aws.String("access_logs.s3.enabled"), Key: aws.String("access_logs.s3.enabled"),
Value: aws.String(log["enabled"].(bool)), Value: aws.String(strconv.FormatBool(log["enabled"].(bool))),
}, },
&elbv2.LoadBalancerAttribute{ &elbv2.LoadBalancerAttribute{
Key: aws.String("access_logs.s3.bucket"), Key: aws.String("access_logs.s3.bucket"),
@ -297,7 +297,7 @@ func resourceAwsAlbUpdate(d *schema.ResourceData, meta interface{}) error {
} else if len(logs) == 0 { } else if len(logs) == 0 {
attributes = append(attributes, &elbv2.LoadBalancerAttribute{ attributes = append(attributes, &elbv2.LoadBalancerAttribute{
Key: aws.String("access_logs.s3.enabled"), Key: aws.String("access_logs.s3.enabled"),
Value: aws.String("false"), Value: aws.String(strconv.FormatBool(false)),
}) })
} }
} }

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.#", "1"),
resource.TestCheckResourceAttr("aws_alb.alb_test", "access_logs.0.bucket", bucketName), 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.prefix", "testAccAWSALBConfig_accessLogs"),
resource.TestCheckResourceAttr("aws_alb.alb_test", "access_logs.0.enabled", "true"),
resource.TestCheckResourceAttrSet("aws_alb.alb_test", "arn"), resource.TestCheckResourceAttrSet("aws_alb.alb_test", "arn"),
), ),
}, },
@ -582,6 +583,7 @@ func testAccAWSALBConfig_accessLogs(albName, bucketName string) string {
access_logs { access_logs {
bucket = "${aws_s3_bucket.logs.bucket}" bucket = "${aws_s3_bucket.logs.bucket}"
prefix = "${var.bucket_prefix}" prefix = "${var.bucket_prefix}"
enabled = "${var.enabled}"
} }
tags { tags {