validate aws_alb_target_group name is less than 32 characters (#11699)

This commit is contained in:
netjunki 2017-02-05 02:24:24 -08:00 committed by Paul Stack
parent 1ab38ceae5
commit 64e2381cb2

View File

@ -37,9 +37,10 @@ func resourceAwsAlbTargetGroup() *schema.Resource {
},
"name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validateAwsAlbTargetGroupName,
},
"port": {
@ -436,6 +437,14 @@ func validateAwsAlbTargetGroupHealthCheckProtocol(v interface{}, k string) (ws [
return
}
func validateAwsAlbTargetGroupName(v interface{}, k string) (ws []string, errors []error) {
name := v.(string)
if len(name) > 32 {
errors = append(errors, fmt.Errorf("%q (%q) cannot be longer than '32' characters", k, name))
}
return
}
func validateAwsAlbTargetGroupPort(v interface{}, k string) (ws []string, errors []error) {
port := v.(int)
if port < 1 || port > 65536 {