limiting subnetgroup name to alphanumeric and hyphens

This commit is contained in:
Dennis Webb 2016-10-21 11:28:48 -05:00
parent 7d7da4b6b6
commit 05783ca044
2 changed files with 10 additions and 2 deletions

View File

@ -174,9 +174,9 @@ func subnetIdsToSlice(subnetIds []*redshift.Subnet) []string {
func validateRedshiftSubnetGroupName(v interface{}, k string) (ws []string, errors []error) {
value := v.(string)
if !regexp.MustCompile(`^[0-9a-z-_]+$`).MatchString(value) {
if !regexp.MustCompile(`^[0-9a-z-]+$`).MatchString(value) {
errors = append(errors, fmt.Errorf(
"only lowercase alphanumeric characters, hyphens, underscores, and periods allowed in %q", k))
"only lowercase alphanumeric characters and hyphens allowed in %q", k))
}
if len(value) > 255 {
errors = append(errors, fmt.Errorf(

View File

@ -79,6 +79,14 @@ func TestResourceAWSRedshiftSubnetGroupNameValidation(t *testing.T) {
Value: "TestingSG",
ErrCount: 1,
},
{
Value: "testing_123",
ErrCount: 1,
},
{
Value: "testing.123",
ErrCount: 1,
},
{
Value: randomString(256),
ErrCount: 1,