From a443144c899bf227e295a7f688c8cab4e4599192 Mon Sep 17 00:00:00 2001 From: lian Date: Mon, 25 Apr 2016 21:53:31 +0200 Subject: [PATCH] provider-aws: validate cluster_id length for aws_elasticache_cluster (#6330) --- builtin/providers/aws/resource_aws_elasticache_cluster.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/builtin/providers/aws/resource_aws_elasticache_cluster.go b/builtin/providers/aws/resource_aws_elasticache_cluster.go index f8c422484f..e8bbc17c2b 100644 --- a/builtin/providers/aws/resource_aws_elasticache_cluster.go +++ b/builtin/providers/aws/resource_aws_elasticache_cluster.go @@ -33,6 +33,14 @@ func resourceAwsElasticacheCluster() *schema.Resource { // with non-converging diffs. return strings.ToLower(val.(string)) }, + ValidateFunc: func(v interface{}, k string) (ws []string, errors []error) { + 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)) + } + return + }, }, "configuration_endpoint": &schema.Schema{ Type: schema.TypeString,