diff --git a/aws/validators.go b/aws/validators.go index 3d65d37f5bb7..a4eae8c6bece 100644 --- a/aws/validators.go +++ b/aws/validators.go @@ -1517,8 +1517,8 @@ func validateAwsKmsGrantName(v interface{}, k string) (ws []string, es []error) func validateCognitoIdentityPoolName(v interface{}, k string) (ws []string, errors []error) { val := v.(string) - if !regexp.MustCompile(`^[\w _]+$`).MatchString(val) { - errors = append(errors, fmt.Errorf("%q must contain only alphanumeric characters and spaces", k)) + if !regexp.MustCompile(`^[\w\s+=,.@-]+$`).MatchString(val) { + errors = append(errors, fmt.Errorf("%q must contain only alphanumeric characters, dots, underscores and hyphens", k)) } return diff --git a/aws/validators_test.go b/aws/validators_test.go index 70977da5ddd8..9b1b90ffb83d 100644 --- a/aws/validators_test.go +++ b/aws/validators_test.go @@ -2003,6 +2003,8 @@ func TestValidateCognitoIdentityPoolName(t *testing.T) { "foo bar", "foo_bar", "1foo 2bar 3", + "foo-bar_123", + "foo-bar", } for _, s := range validValues { @@ -2013,11 +2015,10 @@ func TestValidateCognitoIdentityPoolName(t *testing.T) { } invalidValues := []string{ - "1-2-3", - "foo!", - "foo-bar", - "foo-bar", - "foo1-bar2", + "foo*", + "foo:bar", + "foo&bar", + "foo1^bar2", } for _, s := range invalidValues {