Skip to content

Commit

Permalink
provider/aws: Fix the validateFunc of aws_elasticache_replication_gro…
Browse files Browse the repository at this point in the history
…up (hashicorp#9918)

Fixes hashicorp#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
```
  • Loading branch information
stack72 authored Nov 7, 2016
1 parent bf1a13e commit 38cd794
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ func TestResourceAWSElastiCacheReplicationGroupIdValidation(t *testing.T) {
ErrCount: 1,
},
{
Value: randomString(17),
Value: randomString(21),
ErrCount: 1,
},
}
Expand Down

0 comments on commit 38cd794

Please sign in to comment.