provider/aws: add value into ELB name validation message
makes debugging these validation errors much more straightforward
This commit is contained in:
parent
c618132085
commit
55411d692d
|
@ -32,19 +32,20 @@ func resourceAwsElb() *schema.Resource {
|
||||||
value := v.(string)
|
value := v.(string)
|
||||||
if !regexp.MustCompile(`^[0-9A-Za-z-]+$`).MatchString(value) {
|
if !regexp.MustCompile(`^[0-9A-Za-z-]+$`).MatchString(value) {
|
||||||
errors = append(errors, fmt.Errorf(
|
errors = append(errors, fmt.Errorf(
|
||||||
"only alphanumeric characters and hyphens allowed in %q", k))
|
"only alphanumeric characters and hyphens allowed in %q: %q",
|
||||||
|
k, value))
|
||||||
}
|
}
|
||||||
if len(value) > 32 {
|
if len(value) > 32 {
|
||||||
errors = append(errors, fmt.Errorf(
|
errors = append(errors, fmt.Errorf(
|
||||||
"%q cannot be longer than 32 characters", k))
|
"%q cannot be longer than 32 characters: %q", k, value))
|
||||||
}
|
}
|
||||||
if regexp.MustCompile(`^-`).MatchString(value) {
|
if regexp.MustCompile(`^-`).MatchString(value) {
|
||||||
errors = append(errors, fmt.Errorf(
|
errors = append(errors, fmt.Errorf(
|
||||||
"%q cannot begin with a hyphen", k))
|
"%q cannot begin with a hyphen: %q", k, value))
|
||||||
}
|
}
|
||||||
if regexp.MustCompile(`-$`).MatchString(value) {
|
if regexp.MustCompile(`-$`).MatchString(value) {
|
||||||
errors = append(errors, fmt.Errorf(
|
errors = append(errors, fmt.Errorf(
|
||||||
"%q cannot end with a hyphen", k))
|
"%q cannot end with a hyphen: %q", k, value))
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue