Merge pull request #9511 from dennis-bsi/aws-redshift-sng-name-validation

provider/aws: limiting aws_redshift_subnet_group name to alphanumeric and hyphens
This commit is contained in:
Clint 2016-10-21 14:35:53 -05:00 committed by GitHub
commit 6f7e9ac4dd
2 changed files with 10 additions and 2 deletions

View File

@ -175,9 +175,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

@ -108,6 +108,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,