Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provider aws v2.16.0 fails to create a new replica node for elasticache cluster with identifier of 20 characters #9131

Closed
balusarakesh opened this issue Jun 25, 2019 · 6 comments · Fixed by #9941
Assignees
Labels
service/elasticache Issues and PRs that pertain to the elasticache service.
Milestone

Comments

@balusarakesh
Copy link

balusarakesh commented Jun 25, 2019

environment:

Terraform v0.11.13

terragrunt version v0.17.4

aws-cli/1.16.184 Python/2.7.14 Darwin/17.7.0 botocore/1.12.174

TF code:

resource "aws_elasticache_replication_group" "ts" {

  replication_group_id = "${substr("${var.datacenter}-ts-redis-cluster", 0, 
                          min(length("${var.datacenter}-ts-redis-cluster"), 20))}"
  replication_group_description = "${var.datacenter}-ts-redis-cluster"
  automatic_failover_enabled = true
  ...
  ...
  ...
  number_cache_clusters = "3"
}

we are updating the number of replica nodes to 3 and when we apply the above code we see the following error

Error: Error applying plan:

1 error(s) occurred:

* aws_elasticache_replication_group.ts: 1 error(s) occurred:

* aws_elasticache_replication_group.ts: error creating Elasticache Cache Cluster (adding replica): InvalidParameterValue: The parameter CacheClusterIdentifier is not a valid identifier because it is longer than 20 characters.
	status code: 400, request id: c6c5e6f6-975a-11e9-8181-474c4619931c
  • With the existing terraform provider aws version the cluster id is limited to only 20 characters.
  • We have a couple of existing replica nodes with more than 20 characters in length
  • The cluster is created by hand and we are importing it to terraform
  • We tried to run the command aws elasticache increase-replica-count --replication-group-id speyside-ts-redis-cl --new-replica-count 2 --apply-immediately with awscli version <1.2 and we got the same error. When we updated awscli version to 1.16.184 it is working fine.
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Jun 25, 2019
@balusarakesh balusarakesh changed the title provider aws v2.16.0 fails to create a new replica node for elasticache cluster with identifier more than 20 characters provider aws v2.16.0 fails to create a new replica node for elasticache cluster with identifier of 20 characters Jun 25, 2019
@aeschright aeschright added the service/elasticache Issues and PRs that pertain to the elasticache service. label Jul 3, 2019
@schainks
Copy link

schainks commented Aug 7, 2019

This issue can be worked around with AWS CLI, but obviously means it happens outside of terraform state management.

Try something like:

aws elasticache increase-replica-count --replication-group-id <YOUR GROUP ID> --new-replica-count <INTEGER> --region <REGION> --apply-immediately

Elasticache should spin up replicas in a different AZ than the primary.

The fix for this would be if terraform provider can copy whatever API call the AWS CLI is doing to modify clusters that were created before this identifier string length limit was imposed. I do not expect AWS to raise this limit anytime soon, but they clearly are allowing users to work around it, and terraform should also allow for this.

@bflad bflad self-assigned this Aug 30, 2019
bflad added a commit that referenced this issue Aug 30, 2019
…ntifiers

This also switches some of the hardcoded us-west-2 testing to use the aws_availability_zones data source so the testing is more region agnostic. Now its at least possible to run parallel testing locally in us-east-1 of an EC2-Classic enabled AWS account.

References:

- #9906
- #9131
- #7409
- #5381

Output from acceptance testing:

```
--- PASS: TestAccAWSElasticacheCluster_AZMode_Memcached_Ec2Classic (515.21s)
--- PASS: TestAccAWSElasticacheCluster_AZMode_Redis_Ec2Classic (507.64s)
--- PASS: TestAccAWSElasticacheCluster_Engine_Memcached_Ec2Classic (663.59s)
--- PASS: TestAccAWSElasticacheCluster_Engine_Redis_Ec2Classic (595.65s)
--- PASS: TestAccAWSElasticacheCluster_EngineVersion_Memcached_Ec2Classic (1260.72s)
--- PASS: TestAccAWSElasticacheCluster_EngineVersion_Redis_Ec2Classic (1303.63s)
--- PASS: TestAccAWSElasticacheCluster_multiAZInVpc (737.16s)
--- PASS: TestAccAWSElasticacheCluster_NodeTypeResize_Memcached_Ec2Classic (954.44s)
--- PASS: TestAccAWSElasticacheCluster_NodeTypeResize_Redis_Ec2Classic (1022.11s)
--- PASS: TestAccAWSElasticacheCluster_NumCacheNodes_Decrease (995.54s)
--- PASS: TestAccAWSElasticacheCluster_NumCacheNodes_Increase (1038.00s)
--- PASS: TestAccAWSElasticacheCluster_NumCacheNodes_IncreaseWithPreferredAvailabilityZones (958.56s)
--- PASS: TestAccAWSElasticacheCluster_NumCacheNodes_Redis_Ec2Classic (6.63s)
--- PASS: TestAccAWSElasticacheCluster_ParameterGroupName_Default (596.16s)
--- PASS: TestAccAWSElasticacheCluster_Port_Ec2Classic (576.63s)
--- PASS: TestAccAWSElasticacheCluster_ReplicationGroupID_AvailabilityZone_Ec2Classic (1214.33s)
--- PASS: TestAccAWSElasticacheCluster_ReplicationGroupID_InvalidAttributes (8.37s)
--- PASS: TestAccAWSElasticacheCluster_ReplicationGroupID_MultipleReplica_Ec2Classic (1884.91s)
--- PASS: TestAccAWSElasticacheCluster_ReplicationGroupID_SingleReplica_Ec2Classic (1746.94s)
--- PASS: TestAccAWSElasticacheCluster_SecurityGroup (626.97s)
--- PASS: TestAccAWSElasticacheCluster_snapshotsWithUpdates (1167.22s)
--- PASS: TestAccAWSElasticacheCluster_vpc (646.18s)
--- PASS: TestAccAWSElasticacheReplicationGroup_basic (1857.56s)
--- PASS: TestAccAWSElasticacheReplicationGroup_clusteringAndCacheNodesCausesError (10.99s)
--- PASS: TestAccAWSElasticacheReplicationGroup_ClusterMode_Basic (1875.48s)
--- PASS: TestAccAWSElasticacheReplicationGroup_ClusterMode_NumNodeGroups (3713.74s)
--- PASS: TestAccAWSElasticacheReplicationGroup_enableAtRestEncryption (1419.18s)
--- PASS: TestAccAWSElasticacheReplicationGroup_enableAuthTokenTransitEncryption (734.55s)
--- PASS: TestAccAWSElasticacheReplicationGroup_enableSnapshotting (1917.01s)
--- PASS: TestAccAWSElasticacheReplicationGroup_importBasic (806.91s)
--- PASS: TestAccAWSElasticacheReplicationGroup_multiAzInVpc (950.44s)
--- PASS: TestAccAWSElasticacheReplicationGroup_NumberCacheClusters (2821.85s)
--- PASS: TestAccAWSElasticacheReplicationGroup_NumberCacheClusters_Failover_AutoFailoverDisabled (2029.86s)
--- PASS: TestAccAWSElasticacheReplicationGroup_NumberCacheClusters_Failover_AutoFailoverEnabled (1919.87s)
--- PASS: TestAccAWSElasticacheReplicationGroup_redisClusterInVpc2 (737.16s)
--- PASS: TestAccAWSElasticacheReplicationGroup_updateDescription (1240.24s)
--- PASS: TestAccAWSElasticacheReplicationGroup_updateMaintenanceWindow (1047.59s)
--- PASS: TestAccAWSElasticacheReplicationGroup_updateNodeSize (1985.53s)
--- PASS: TestAccAWSElasticacheReplicationGroup_updateParameterGroup (900.33s)
--- PASS: TestAccAWSElasticacheReplicationGroup_Uppercase (594.69s)
--- PASS: TestAccAWSElasticacheReplicationGroup_vpc (1355.75s)
```
@bflad
Copy link
Contributor

bflad commented Aug 30, 2019

The Elasticache service now supports cluster identifiers up to 50 characters. We will support this new limit via: #9941

@schainks
Copy link

schainks commented Sep 5, 2019

What about modifying existing clusters that were named before the limit went into place?

@bflad bflad added this to the v2.28.0 milestone Sep 6, 2019
@bflad
Copy link
Contributor

bflad commented Sep 6, 2019

The above has been merged and will release in version 2.28.0 of the Terraform AWS Provider, Thursday. 👍

What about modifying existing clusters that were named before the limit went into place?

The AWS Announcement does not provide any detail into this. From Terraform's perspective, we will allow and/or passthrough any configured value (under the new 50 character limit) to the Elasticache API.

@ghost
Copy link

ghost commented Sep 12, 2019

This has been released in version 2.28.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

@ghost
Copy link

ghost commented Nov 1, 2019

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Nov 1, 2019
@breathingdust breathingdust removed the needs-triage Waiting for first response or review from a maintainer. label Sep 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
service/elasticache Issues and PRs that pertain to the elasticache service.
Projects
None yet
5 participants