From 38cd7947b6360cb9e904891ec6d4ef020586fcf1 Mon Sep 17 00:00:00 2001 From: Paul Stack Date: Mon, 7 Nov 2016 21:02:00 +0000 Subject: [PATCH] provider/aws: Fix the validateFunc of aws_elasticache_replication_group (#9918) Fixes #9895 The replication_group_id should allow length to be max of 20 not 16 ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestResourceAWSElastiCacheReplicationGroupIdValidation' ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2016/11/07 16:17:52 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestResourceAWSElastiCacheReplicationGroupIdValidation -timeout 120m === RUN TestResourceAWSElastiCacheReplicationGroupIdValidation --- PASS: TestResourceAWSElastiCacheReplicationGroupIdValidation (0.00s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws0.032s ``` --- .../aws/resource_aws_elasticache_replication_group.go | 4 ++-- .../aws/resource_aws_elasticache_replication_group_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/builtin/providers/aws/resource_aws_elasticache_replication_group.go b/builtin/providers/aws/resource_aws_elasticache_replication_group.go index 19cd9f1ba2..8f85dac296 100644 --- a/builtin/providers/aws/resource_aws_elasticache_replication_group.go +++ b/builtin/providers/aws/resource_aws_elasticache_replication_group.go @@ -456,9 +456,9 @@ func validateAwsElastiCacheReplicationGroupEngine(v interface{}, k string) (ws [ func validateAwsElastiCacheReplicationGroupId(v interface{}, k string) (ws []string, errors []error) { value := v.(string) - if (len(value) < 1) || (len(value) > 16) { + if (len(value) < 1) || (len(value) > 20) { errors = append(errors, fmt.Errorf( - "%q must contain from 1 to 16 alphanumeric characters or hyphens", k)) + "%q must contain from 1 to 20 alphanumeric characters or hyphens", k)) } if !regexp.MustCompile(`^[0-9a-zA-Z-]+$`).MatchString(value) { errors = append(errors, fmt.Errorf( diff --git a/builtin/providers/aws/resource_aws_elasticache_replication_group_test.go b/builtin/providers/aws/resource_aws_elasticache_replication_group_test.go index 8ba271f964..921638206a 100644 --- a/builtin/providers/aws/resource_aws_elasticache_replication_group_test.go +++ b/builtin/providers/aws/resource_aws_elasticache_replication_group_test.go @@ -235,7 +235,7 @@ func TestResourceAWSElastiCacheReplicationGroupIdValidation(t *testing.T) { ErrCount: 1, }, { - Value: randomString(17), + Value: randomString(21), ErrCount: 1, }, }