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.
This commit is contained in:
Joshua Spence 2017-04-26 09:48:02 +10:00 committed by Paul Stack
parent 87ebc19ae5
commit 76b0eefacc
2 changed files with 3 additions and 3 deletions

View File

@ -48,7 +48,7 @@ func resourceAwsAlb() *schema.Resource {
Type: schema.TypeString, Type: schema.TypeString,
Optional: true, Optional: true,
ForceNew: true, ForceNew: true,
ValidateFunc: validateElbName, ValidateFunc: validateElbNamePrefix,
}, },
"internal": { "internal": {

View File

@ -113,7 +113,7 @@ func TestAccAWSALB_namePrefix(t *testing.T) {
testAccCheckAWSALBExists("aws_alb.alb_test", &conf), testAccCheckAWSALBExists("aws_alb.alb_test", &conf),
resource.TestCheckResourceAttrSet("aws_alb.alb_test", "name"), resource.TestCheckResourceAttrSet("aws_alb.alb_test", "name"),
resource.TestMatchResourceAttr("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 { func testAccAWSALBConfig_namePrefix() string {
return fmt.Sprintf(` return fmt.Sprintf(`
resource "aws_alb" "alb_test" { resource "aws_alb" "alb_test" {
name_prefix = "tf-lb" name_prefix = "tf-lb-"
internal = true internal = true
security_groups = ["${aws_security_group.alb_test.id}"] security_groups = ["${aws_security_group.alb_test.id}"]
subnets = ["${aws_subnet.alb_test.*.id}"] subnets = ["${aws_subnet.alb_test.*.id}"]