From 76b0eefaccf93293fb6914c223d5526dc9395c51 Mon Sep 17 00:00:00 2001 From: Joshua Spence Date: Wed, 26 Apr 2017 09:48:02 +1000 Subject: [PATCH] Fix validation of the `name_prefix` parameter of the `aws_alb` resource (#13441) This parameter is being validated using the wrong validation function, which means that we are incorrectly disallowing a `name_prefix` value ending with a dash. --- builtin/providers/aws/resource_aws_alb.go | 2 +- builtin/providers/aws/resource_aws_alb_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/builtin/providers/aws/resource_aws_alb.go b/builtin/providers/aws/resource_aws_alb.go index ed756e939..fe94dd0fa 100644 --- a/builtin/providers/aws/resource_aws_alb.go +++ b/builtin/providers/aws/resource_aws_alb.go @@ -48,7 +48,7 @@ func resourceAwsAlb() *schema.Resource { Type: schema.TypeString, Optional: true, ForceNew: true, - ValidateFunc: validateElbName, + ValidateFunc: validateElbNamePrefix, }, "internal": { diff --git a/builtin/providers/aws/resource_aws_alb_test.go b/builtin/providers/aws/resource_aws_alb_test.go index fbebb390d..807d1f4e5 100644 --- a/builtin/providers/aws/resource_aws_alb_test.go +++ b/builtin/providers/aws/resource_aws_alb_test.go @@ -113,7 +113,7 @@ func TestAccAWSALB_namePrefix(t *testing.T) { testAccCheckAWSALBExists("aws_alb.alb_test", &conf), resource.TestCheckResourceAttrSet("aws_alb.alb_test", "name"), resource.TestMatchResourceAttr("aws_alb.alb_test", "name", - regexp.MustCompile("^tf-lb")), + regexp.MustCompile("^tf-lb-")), ), }, }, @@ -851,7 +851,7 @@ resource "aws_security_group" "alb_test" { func testAccAWSALBConfig_namePrefix() string { return fmt.Sprintf(` resource "aws_alb" "alb_test" { - name_prefix = "tf-lb" + name_prefix = "tf-lb-" internal = true security_groups = ["${aws_security_group.alb_test.id}"] subnets = ["${aws_subnet.alb_test.*.id}"]