From 57988db500cdf5f7f6ee60a7cc1a3b258dc0859e Mon Sep 17 00:00:00 2001 From: Satoshi Tanaka Date: Thu, 31 Oct 2019 11:15:06 +0900 Subject: [PATCH 1/2] add test to validate elb name begin with "internal-" into validateElbName --- aws/validators_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/aws/validators_test.go b/aws/validators_test.go index 900c11308f2..fe10748255b 100644 --- a/aws/validators_test.go +++ b/aws/validators_test.go @@ -1591,6 +1591,7 @@ func TestValidateElbName(t *testing.T) { "tf-test-elb-tf-test-elb-tf-test-elb", "-tf-test-elb", "tf-test-elb-", + "internal-tf-test-elb", } for _, s := range invalidNames { From 59b790ac1f1d642e7c5252364d40c36526be2d51 Mon Sep 17 00:00:00 2001 From: Satoshi Tanaka Date: Thu, 31 Oct 2019 11:34:36 +0900 Subject: [PATCH 2/2] add validation to elb name to not begin with "internal-" into validateElbName --- aws/validators.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/aws/validators.go b/aws/validators.go index 526eb613492..a08f9b3b4db 100644 --- a/aws/validators.go +++ b/aws/validators.go @@ -419,6 +419,10 @@ func validateElbName(v interface{}, k string) (ws []string, errors []error) { errors = append(errors, fmt.Errorf( "%q cannot end with a hyphen: %q", k, value)) } + if strings.HasPrefix(value, "internal-") { + errors = append(errors, fmt.Errorf( + "%q cannot begin with `internal-`: %q", k, value)) + } return }