Merge pull request #12189 from netjunki/which-elastic-cluster-id

aws/provider: what was the value of the cluster id which caused the problem
This commit is contained in:
Joseph Anthony Pasquale Holsten 2017-02-22 18:10:07 -08:00 committed by GitHub
commit 73f4acf041
1 changed files with 5 additions and 5 deletions

View File

@ -36,23 +36,23 @@ func validateElastiCacheClusterId(v interface{}, k string) (ws []string, errors
value := v.(string)
if (len(value) < 1) || (len(value) > 20) {
errors = append(errors, fmt.Errorf(
"%q must contain from 1 to 20 alphanumeric characters or hyphens", k))
"%q (%q) must contain from 1 to 20 alphanumeric characters or hyphens", k, value))
}
if !regexp.MustCompile(`^[0-9a-z-]+$`).MatchString(value) {
errors = append(errors, fmt.Errorf(
"only lowercase alphanumeric characters and hyphens allowed in %q", k))
"only lowercase alphanumeric characters and hyphens allowed in %q (%q)", k, value))
}
if !regexp.MustCompile(`^[a-z]`).MatchString(value) {
errors = append(errors, fmt.Errorf(
"first character of %q must be a letter", k))
"first character of %q (%q) must be a letter", k, value))
}
if regexp.MustCompile(`--`).MatchString(value) {
errors = append(errors, fmt.Errorf(
"%q cannot contain two consecutive hyphens", k))
"%q (%q) cannot contain two consecutive hyphens", k, value))
}
if regexp.MustCompile(`-$`).MatchString(value) {
errors = append(errors, fmt.Errorf(
"%q cannot end with a hyphen", k))
"%q (%q) cannot end with a hyphen", k, value))
}
return
}