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

elasticache: Adds Redis 6.x support #18920

Merged
merged 7 commits into from
Apr 23, 2021
Merged

elasticache: Adds Redis 6.x support #18920

merged 7 commits into from
Apr 23, 2021

Conversation

gdavison
Copy link
Contributor

@gdavison gdavison commented Apr 16, 2021

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Adds support for specifying Redis version 6.x. This was due to a change in how AWS specifies Redis versions: prior to version 6, the full version was specified, e.g. 5.0.6. Staring with version 6, only the major version is specified followed by .x. The AWS API, however, returns the full deployed version in the corresponding parameter, leading to perpetual plan differences.

This PR adds validation and handling to the engine_version parameter to specify it as needed by the API. It also adds the parameter engine_version_actual to output the actual in-use version. Additionally, in aws_elasticache_global_replication_group, it deprecates actual_engine_version in favour of engine_version_actual.

Closes #15625
Closes #18539

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccAWSElasticacheCluster\|TestAccAWSElasticacheGlobalReplicationGroup\|TestAccAWSElasticacheReplicationGroup'

--- SKIP: TestAccAWSElasticacheCluster_SecurityGroup_Ec2Classic (2.23s)
--- PASS: TestAccAWSElasticacheCluster_NumCacheNodes_Redis (13.80s)
--- PASS: TestAccAWSElasticacheCluster_Port_Redis_Default (495.39s)
--- PASS: TestAccAWSElasticacheCluster_Memcached_FinalSnapshot (2.79s)
--- PASS: TestAccAWSElasticacheCluster_Port (617.02s)
--- PASS: TestAccAWSElasticacheCluster_AZMode_Redis (617.69s)
--- PASS: TestAccAWSElasticacheCluster_vpc (632.82s)
--- PASS: TestAccAWSElasticacheCluster_AZMode_Memcached (639.96s)
--- PASS: TestAccAWSElasticacheCluster_ParameterGroupName_Default (640.42s)
--- PASS: TestAccAWSElasticacheCluster_Engine_Redis (654.64s)
--- PASS: TestAccAWSElasticacheCluster_snapshotsWithUpdates (673.72s)
--- PASS: TestAccAWSElasticacheCluster_Engine_Memcached (676.60s)
--- PASS: TestAccAWSElasticacheCluster_multiAZInVpc (679.57s)
--- PASS: TestAccAWSElasticacheCluster_NumCacheNodes_Decrease (929.33s)
--- PASS: TestAccAWSElasticacheCluster_NumCacheNodes_IncreaseWithPreferredAvailabilityZones (1029.14s)
--- PASS: TestAccAWSElasticacheCluster_NumCacheNodes_Increase (1087.77s)
--- PASS: TestAccAWSElasticacheCluster_NodeTypeResize_Memcached (1242.96s)
--- PASS: TestAccAWSElasticacheCluster_Redis_FinalSnapshot (826.97s)
--- PASS: TestAccAWSElasticacheCluster_EngineVersion_Memcached (1326.44s)
--- PASS: TestAccAWSElasticacheCluster_NodeTypeResize_Redis (1384.06s)
--- PASS: TestAccAWSElasticacheCluster_ReplicationGroupID_SingleReplica (1381.91s)
--- PASS: TestAccAWSElasticacheReplicationGroup_Validation_multiAz_NoAutomaticFailover (2.50s)
--- PASS: TestAccAWSElasticacheCluster_ReplicationGroupID_AvailabilityZone (1394.91s)
--- PASS: TestAccAWSElasticacheReplicationGroup_basic (801.42s)
--- PASS: TestAccAWSElasticacheCluster_ReplicationGroupID_MultipleReplica (1493.73s)
--- PASS: TestAccAWSElasticacheGlobalReplicationGroup_disappears (960.43s)
--- PASS: TestAccAWSElasticacheGlobalReplicationGroup_basic (1023.89s)
--- PASS: TestAccAWSElasticacheReplicationGroup_Uppercase (967.71s)
--- PASS: TestAccAWSElasticacheGlobalReplicationGroup_Description (1044.01s)
--- PASS: TestAccAWSElasticacheReplicationGroup_disappears (1150.50s)
--- PASS: TestAccAWSElasticacheReplicationGroup_updateMaintenanceWindow (832.55s)
--- PASS: TestAccAWSElasticacheReplicationGroup_clusteringAndCacheNodesCausesError (1.91s)
--- PASS: TestAccAWSElasticacheReplicationGroup_updateDescription (1022.65s)
--- PASS: TestAccAWSElasticacheCluster_EngineVersion_Redis (2106.49s)
--- PASS: TestAccAWSElasticacheReplicationGroup_redisClusterInVpc2 (958.07s)
--- PASS: TestAccAWSElasticacheReplicationGroup_updateParameterGroup (1114.17s)
--- PASS: TestAccAWSElasticacheReplicationGroup_ClusterMode_SingleNode (891.48s)
--- FAIL: TestAccAWSElasticacheGlobalReplicationGroup_ReplaceSecondary_DifferentRegion (2107.14s)
--- PASS: TestAccAWSElasticacheReplicationGroup_ClusterMode_Basic (1562.71s)
--- PASS: TestAccAWSElasticacheReplicationGroup_enableAuthTokenTransitEncryption (1137.91s)
--- PASS: TestAccAWSElasticacheReplicationGroup_enableAtRestEncryption (1106.66s)
--- PASS: TestAccAWSElasticacheReplicationGroup_useCmkKmsKeyId (993.98s)
--- PASS: TestAccAWSElasticacheReplicationGroup_updateNodeSize (2516.41s)
--- PASS: TestAccAWSElasticacheReplicationGroup_multiAzNotInVpc (2279.69s)
--- PASS: TestAccAWSElasticacheReplicationGroup_ClusterMode_UpdateNumNodeGroups_ScaleUp (2176.34s)
--- PASS: TestAccAWSElasticacheReplicationGroup_ClusterMode_UpdateReplicasPerNodeGroup (2068.33s)
--- PASS: TestAccAWSElasticacheReplicationGroup_Validation_NoNodeType (4.62s)
--- PASS: TestAccAWSElasticacheReplicationGroup_multiAzInVpc (2479.59s)
--- PASS: TestAccAWSElasticacheReplicationGroup_enableSnapshotting (2012.62s)
--- PASS: TestAccAWSElasticacheReplicationGroup_ClusterMode_NonClusteredParameterGroup (2445.77s)
--- PASS: TestAccAWSElasticacheReplicationGroup_NumberCacheClusters_Basic (1792.71s)
--- PASS: TestAccAWSElasticacheReplicationGroup_vpc (2943.24s)
--- PASS: TestAccAWSElasticacheReplicationGroup_EngineVersion_Update (3655.68s)
--- PASS: TestAccAWSElasticacheReplicationGroup_NumberCacheClusters_MemberClusterDisappears_NoChange (1305.79s)
--- PASS: TestAccAWSElasticacheReplicationGroup_Validation_GlobalReplicationGroupIdAndNodeType (851.30s)
--- PASS: TestAccAWSElasticacheReplicationGroup_ClusterMode_UpdateNumNodeGroupsAndReplicasPerNodeGroup_ScaleUp (2954.68s)
--- PASS: TestAccAWSElasticacheReplicationGroup_NumberCacheClusters_Failover_AutoFailoverEnabled (1923.84s)
--- PASS: TestAccAWSElasticacheReplicationGroup_NumberCacheClusters_MemberClusterDisappears_AddMemberCluster (1475.98s)
--- PASS: TestAccAWSElasticacheReplicationGroup_NumberCacheClusters_MemberClusterDisappears_RemoveMemberCluster_AtTargetSize (1408.32s)
--- PASS: TestAccAWSElasticacheReplicationGroup_ClusterMode_UpdateNumNodeGroups_ScaleDown (3166.17s)
--- PASS: TestAccAWSElasticacheReplicationGroup_tags (1183.78s)
--- PASS: TestAccAWSElasticacheReplicationGroup_NumberCacheClusters_MemberClusterDisappears_RemoveMemberCluster_ScaleDown (1335.60s)
--- PASS: TestAccAWSElasticacheReplicationGroup_NumberCacheClusters_MultiAZEnabled (2020.69s)
--- PASS: TestAccAWSElasticacheReplicationGroup_FinalSnapshot (1302.19s)
--- PASS: TestAccAWSElasticacheGlobalReplicationGroup_MultipleSecondaries (4419.23s)
--- PASS: TestAccAWSElasticacheReplicationGroup_NumberCacheClusters_Failover_AutoFailoverDisabled (2444.80s)
--- PASS: TestAccAWSElasticacheReplicationGroup_ClusterMode_UpdateNumNodeGroupsAndReplicasPerNodeGroup_ScaleDown (3578.48s)
--- PASS: TestAccAWSElasticacheReplicationGroup_GlobalReplicationGroupId_Basic (2221.57s)
--- PASS: TestAccAWSElasticacheReplicationGroup_GlobalReplicationGroupId_Full (2405.63s)
--- PASS: TestAccAWSElasticacheReplicationGroup_GlobalReplicationGroupId_disappears (2448.18s)

TestAccAWSElasticacheGlobalReplicationGroup_ReplaceSecondary_DifferentRegion failed with an unrelated error: Error creating VPC: VpcLimitExceeded: The maximum number of VPCs has been reached.

@gdavison gdavison requested a review from a team as a code owner April 16, 2021 18:38
@ghost ghost added size/XL Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. service/elasticache Issues and PRs that pertain to the elasticache service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Apr 16, 2021
@gdavison gdavison marked this pull request as draft April 16, 2021 18:38
@gdavison gdavison marked this pull request as ready for review April 16, 2021 22:45
Copy link
Contributor

@bill-rich bill-rich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Just a couple comments on style that may not be applicable.

@@ -268,32 +275,37 @@ func resourceAwsElasticacheCluster() *schema.Resource {
return errors.New(`az_mode "cross-az" is not supported with num_cache_nodes = 1`)
},
func(_ context.Context, diff *schema.ResourceDiff, v interface{}) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would help with readability here to define all the functions and then list them here by name.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I've been thinking about that. It would also make them testable if needed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's also really easy to miss the one named function among all the inline functions

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually did that exact thing on my first read-through :-)

@@ -301,6 +308,9 @@ func resourceAwsElasticacheReplicationGroup() *schema.Resource {
}
return nil
},

CustomizeDiffElastiCacheEngineVersion,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same with this sequence for readability.

aws/resource_aws_elasticache_replication_group.go Outdated Show resolved Hide resolved
Copy link
Contributor

@bill-rich bill-rich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSElasticacheCluster -timeout 180m
=== RUN   TestAccAWSElasticacheCluster_Engine_Memcached
=== PAUSE TestAccAWSElasticacheCluster_Engine_Memcached
=== RUN   TestAccAWSElasticacheCluster_Engine_Redis
=== PAUSE TestAccAWSElasticacheCluster_Engine_Redis
=== RUN   TestAccAWSElasticacheCluster_Port_Redis_Default
=== PAUSE TestAccAWSElasticacheCluster_Port_Redis_Default
=== RUN   TestAccAWSElasticacheCluster_ParameterGroupName_Default
=== PAUSE TestAccAWSElasticacheCluster_ParameterGroupName_Default
=== RUN   TestAccAWSElasticacheCluster_Port
=== PAUSE TestAccAWSElasticacheCluster_Port
=== RUN   TestAccAWSElasticacheCluster_SecurityGroup_Ec2Classic
=== PAUSE TestAccAWSElasticacheCluster_SecurityGroup_Ec2Classic
=== RUN   TestAccAWSElasticacheCluster_snapshotsWithUpdates
=== PAUSE TestAccAWSElasticacheCluster_snapshotsWithUpdates
=== RUN   TestAccAWSElasticacheCluster_NumCacheNodes_Decrease
=== PAUSE TestAccAWSElasticacheCluster_NumCacheNodes_Decrease
=== RUN   TestAccAWSElasticacheCluster_NumCacheNodes_Increase
=== PAUSE TestAccAWSElasticacheCluster_NumCacheNodes_Increase
=== RUN   TestAccAWSElasticacheCluster_NumCacheNodes_IncreaseWithPreferredAvailabilityZones
=== PAUSE TestAccAWSElasticacheCluster_NumCacheNodes_IncreaseWithPreferredAvailabilityZones
=== RUN   TestAccAWSElasticacheCluster_vpc
=== PAUSE TestAccAWSElasticacheCluster_vpc
=== RUN   TestAccAWSElasticacheCluster_multiAZInVpc
=== PAUSE TestAccAWSElasticacheCluster_multiAZInVpc
=== RUN   TestAccAWSElasticacheCluster_AZMode_Memcached
=== PAUSE TestAccAWSElasticacheCluster_AZMode_Memcached
=== RUN   TestAccAWSElasticacheCluster_AZMode_Redis
=== PAUSE TestAccAWSElasticacheCluster_AZMode_Redis
=== RUN   TestAccAWSElasticacheCluster_EngineVersion_Memcached
=== PAUSE TestAccAWSElasticacheCluster_EngineVersion_Memcached
=== RUN   TestAccAWSElasticacheCluster_EngineVersion_Redis
=== PAUSE TestAccAWSElasticacheCluster_EngineVersion_Redis
=== RUN   TestAccAWSElasticacheCluster_NodeTypeResize_Memcached
=== PAUSE TestAccAWSElasticacheCluster_NodeTypeResize_Memcached
=== RUN   TestAccAWSElasticacheCluster_NodeTypeResize_Redis
=== PAUSE TestAccAWSElasticacheCluster_NodeTypeResize_Redis
=== RUN   TestAccAWSElasticacheCluster_NumCacheNodes_Redis
=== PAUSE TestAccAWSElasticacheCluster_NumCacheNodes_Redis
=== RUN   TestAccAWSElasticacheCluster_ReplicationGroupID_AvailabilityZone
=== PAUSE TestAccAWSElasticacheCluster_ReplicationGroupID_AvailabilityZone
=== RUN   TestAccAWSElasticacheCluster_ReplicationGroupID_SingleReplica
=== PAUSE TestAccAWSElasticacheCluster_ReplicationGroupID_SingleReplica
=== RUN   TestAccAWSElasticacheCluster_ReplicationGroupID_MultipleReplica
=== PAUSE TestAccAWSElasticacheCluster_ReplicationGroupID_MultipleReplica
=== RUN   TestAccAWSElasticacheCluster_Memcached_FinalSnapshot
=== PAUSE TestAccAWSElasticacheCluster_Memcached_FinalSnapshot
=== RUN   TestAccAWSElasticacheCluster_Redis_FinalSnapshot
=== PAUSE TestAccAWSElasticacheCluster_Redis_FinalSnapshot
=== CONT  TestAccAWSElasticacheCluster_Engine_Memcached
=== CONT  TestAccAWSElasticacheCluster_Redis_FinalSnapshot
=== CONT  TestAccAWSElasticacheCluster_AZMode_Memcached
=== CONT  TestAccAWSElasticacheCluster_SecurityGroup_Ec2Classic
=== CONT  TestAccAWSElasticacheCluster_multiAZInVpc
=== CONT  TestAccAWSElasticacheCluster_Memcached_FinalSnapshot
=== CONT  TestAccAWSElasticacheCluster_snapshotsWithUpdates
=== CONT  TestAccAWSElasticacheCluster_ReplicationGroupID_MultipleReplica
=== CONT  TestAccAWSElasticacheCluster_ReplicationGroupID_SingleReplica
=== CONT  TestAccAWSElasticacheCluster_ReplicationGroupID_AvailabilityZone
=== CONT  TestAccAWSElasticacheCluster_NumCacheNodes_Redis
=== CONT  TestAccAWSElasticacheCluster_NodeTypeResize_Redis
=== CONT  TestAccAWSElasticacheCluster_NodeTypeResize_Memcached
=== CONT  TestAccAWSElasticacheCluster_EngineVersion_Redis
=== CONT  TestAccAWSElasticacheCluster_EngineVersion_Memcached
=== CONT  TestAccAWSElasticacheCluster_Port_Redis_Default
=== CONT  TestAccAWSElasticacheCluster_ParameterGroupName_Default
=== CONT  TestAccAWSElasticacheCluster_AZMode_Redis
=== CONT  TestAccAWSElasticacheCluster_Engine_Redis
=== CONT  TestAccAWSElasticacheCluster_Port
--- PASS: TestAccAWSElasticacheCluster_NumCacheNodes_Redis (4.63s)
=== CONT  TestAccAWSElasticacheCluster_NumCacheNodes_IncreaseWithPreferredAvailabilityZones
--- PASS: TestAccAWSElasticacheCluster_Memcached_FinalSnapshot (5.01s)
=== CONT  TestAccAWSElasticacheCluster_vpc
--- PASS: TestAccAWSElasticacheCluster_Port_Redis_Default (475.17s)
=== CONT  TestAccAWSElasticacheCluster_NumCacheNodes_Increase
--- PASS: TestAccAWSElasticacheCluster_SecurityGroup_Ec2Classic (561.43s)
=== CONT  TestAccAWSElasticacheCluster_NumCacheNodes_Decrease
--- PASS: TestAccAWSElasticacheCluster_Engine_Redis (598.55s)
--- PASS: TestAccAWSElasticacheCluster_ParameterGroupName_Default (607.56s)
--- PASS: TestAccAWSElasticacheCluster_AZMode_Redis (622.46s)
--- PASS: TestAccAWSElasticacheCluster_Port (624.21s)
--- PASS: TestAccAWSElasticacheCluster_AZMode_Memcached (624.75s)
--- PASS: TestAccAWSElasticacheCluster_Engine_Memcached (628.20s)
--- PASS: TestAccAWSElasticacheCluster_vpc (656.56s)
--- PASS: TestAccAWSElasticacheCluster_multiAZInVpc (706.65s)
--- PASS: TestAccAWSElasticacheCluster_snapshotsWithUpdates (707.94s)
--- PASS: TestAccAWSElasticacheCluster_Redis_FinalSnapshot (809.49s)
--- PASS: TestAccAWSElasticacheCluster_NumCacheNodes_IncreaseWithPreferredAvailabilityZones (1117.90s)
--- PASS: TestAccAWSElasticacheCluster_NodeTypeResize_Memcached (1227.77s)
--- PASS: TestAccAWSElasticacheCluster_ReplicationGroupID_AvailabilityZone (1369.45s)
--- PASS: TestAccAWSElasticacheCluster_NodeTypeResize_Redis (1369.98s)
--- PASS: TestAccAWSElasticacheCluster_EngineVersion_Memcached (1395.04s)
--- PASS: TestAccAWSElasticacheCluster_ReplicationGroupID_MultipleReplica (1434.90s)
--- PASS: TestAccAWSElasticacheCluster_ReplicationGroupID_SingleReplica (1435.60s)
--- PASS: TestAccAWSElasticacheCluster_NumCacheNodes_Decrease (897.34s)
--- PASS: TestAccAWSElasticacheCluster_NumCacheNodes_Increase (1019.81s)
--- PASS: TestAccAWSElasticacheCluster_EngineVersion_Redis (2091.81s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	2091.853s

@gdavison gdavison merged commit 2e6e9bf into main Apr 23, 2021
@gdavison gdavison deleted the elasticache-redis-6 branch April 23, 2021 20:33
@github-actions github-actions bot added this to the v3.38.0 milestone Apr 23, 2021
github-actions bot pushed a commit that referenced this pull request Apr 23, 2021
@ghost
Copy link

ghost commented Apr 30, 2021

This has been released in version 3.38.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!

@github-actions
Copy link

github-actions bot commented Jun 1, 2021

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. service/elasticache Issues and PRs that pertain to the elasticache service. size/XL Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

resource/aws_elasticache_cluster: Cannot specify Redis 6.x Elasticache redis 6.x support
2 participants