Added the validation for the app-cookie-stickiness-policy after the AWS API returned an error

This commit is contained in:
stack72 2015-09-19 20:01:49 +01:00
parent 6337c350f5
commit 679563951c
1 changed files with 9 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package aws
import (
"fmt"
"regexp"
"strings"
"github.com/aws/aws-sdk-go/aws"
@ -25,6 +26,14 @@ func resourceAwsAppCookieStickinessPolicy() *schema.Resource {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: func(v interface{}, k string) (ws []string, es []error) {
value := v.(string)
if !regexp.MustCompile(`^[0-9A-Za-z-]+$`).MatchString(value) {
es = append(es, fmt.Errorf(
"only alphanumeric characters and hyphens allowed in %q", k))
}
return
},
},
"load_balancer": &schema.Schema{