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:
commit
6f7e9ac4dd
|
@ -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(
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue