what was the value of the cluster id which caused the problem

This commit is contained in:
Ben Lau 2017-02-22 17:26:53 -08:00
parent 79c4935604
commit ae2d7f7065
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
}