From 1c5c58d07253b1556703897d55bad040dea2da10 Mon Sep 17 00:00:00 2001 From: Ethan Gunderson Date: Wed, 30 Mar 2016 17:22:15 -0500 Subject: [PATCH] Redshift master usernames may contain underscores --- builtin/providers/aws/resource_aws_redshift_cluster.go | 2 +- builtin/providers/aws/resource_aws_redshift_cluster_test.go | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/builtin/providers/aws/resource_aws_redshift_cluster.go b/builtin/providers/aws/resource_aws_redshift_cluster.go index b77f0527f053..f648a95ebf12 100644 --- a/builtin/providers/aws/resource_aws_redshift_cluster.go +++ b/builtin/providers/aws/resource_aws_redshift_cluster.go @@ -579,7 +579,7 @@ func validateRedshiftClusterFinalSnapshotIdentifier(v interface{}, k string) (ws func validateRedshiftClusterMasterUsername(v interface{}, k string) (ws []string, errors []error) { value := v.(string) - if !regexp.MustCompile(`^[A-Za-z0-9]+$`).MatchString(value) { + if !regexp.MustCompile(`^\w+$`).MatchString(value) { errors = append(errors, fmt.Errorf( "only alphanumeric characters in %q", k)) } diff --git a/builtin/providers/aws/resource_aws_redshift_cluster_test.go b/builtin/providers/aws/resource_aws_redshift_cluster_test.go index 938d5c7a5ed7..93bf29c54356 100644 --- a/builtin/providers/aws/resource_aws_redshift_cluster_test.go +++ b/builtin/providers/aws/resource_aws_redshift_cluster_test.go @@ -257,6 +257,10 @@ func TestResourceAWSRedshiftClusterMasterUsernameValidation(t *testing.T) { Value: randomString(129), ErrCount: 1, }, + { + Value: "testing_testing123", + ErrCount: 0, + }, } for _, tc := range cases {