limiting subnetgroup name to alphanumeric and hyphens
This commit is contained in:
parent
7d7da4b6b6
commit
05783ca044
|
@ -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(
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue