From e94fcdb9df41abafc434ef287cdddb421ec8278c Mon Sep 17 00:00:00 2001 From: clint shryock Date: Fri, 13 Nov 2015 10:46:27 -0600 Subject: [PATCH] add validation for cookie stickiness --- .../aws/resource_aws_lb_cookie_stickiness_policy.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/builtin/providers/aws/resource_aws_lb_cookie_stickiness_policy.go b/builtin/providers/aws/resource_aws_lb_cookie_stickiness_policy.go index a5189fdc2..ea2215b6a 100644 --- a/builtin/providers/aws/resource_aws_lb_cookie_stickiness_policy.go +++ b/builtin/providers/aws/resource_aws_lb_cookie_stickiness_policy.go @@ -42,6 +42,14 @@ func resourceAwsLBCookieStickinessPolicy() *schema.Resource { Type: schema.TypeInt, Optional: true, ForceNew: true, + ValidateFunc: func(v interface{}, k string) (ws []string, es []error) { + value := v.(int) + if value <= 0 { + es = append(es, fmt.Errorf( + "LB Cookie Expiration Period must be greater than zero if specified")) + } + return + }, }, }, }