From 1135640455df0ee16ef76bb5b0c6c3f069483b98 Mon Sep 17 00:00:00 2001
From: Melissa Greenbaum <69476188+magreenbaum@users.noreply.github.com>
Date: Thu, 17 Oct 2024 11:24:49 -0400
Subject: [PATCH] feat: Support
`aws_elasticache_user_group_association.timeouts` and
`aws_elasticache_replication_group.cluster_mode` (#21)
---
README.md | 5 +++--
examples/memcached-cluster/README.md | 4 ++--
examples/memcached-cluster/versions.tf | 2 +-
examples/redis-cluster-mode/README.md | 4 ++--
examples/redis-cluster-mode/versions.tf | 2 +-
examples/redis-cluster/README.md | 4 ++--
examples/redis-cluster/versions.tf | 2 +-
examples/redis-global-replication-group/README.md | 6 +++---
examples/redis-global-replication-group/versions.tf | 2 +-
.../README.md | 4 ++--
.../versions.tf | 2 +-
examples/redis-replication-group/README.md | 4 ++--
examples/redis-replication-group/versions.tf | 2 +-
examples/serverless-cache/main.tf | 3 +++
examples/serverless-cache/versions.tf | 2 +-
main.tf | 2 ++
modules/serverless-cache/README.md | 4 ++--
modules/serverless-cache/versions.tf | 2 +-
modules/user-group/README.md | 4 ++--
modules/user-group/main.tf | 8 ++++++++
modules/user-group/versions.tf | 2 +-
variables.tf | 6 ++++++
versions.tf | 2 +-
23 files changed, 49 insertions(+), 29 deletions(-)
diff --git a/README.md b/README.md
index cc03bfb..dcbc37b 100644
--- a/README.md
+++ b/README.md
@@ -284,14 +284,14 @@ Examples codified under the [`examples`](https://github.com/terraform-aws-module
| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 1.0 |
-| [aws](#requirement\_aws) | >= 5.47 |
+| [aws](#requirement\_aws) | >= 5.71 |
| [random](#requirement\_random) | >= 3.0 |
## Providers
| Name | Version |
|------|---------|
-| [aws](#provider\_aws) | >= 5.47 |
+| [aws](#provider\_aws) | >= 5.71 |
| [random](#provider\_random) | >= 3.0 |
## Modules
@@ -327,6 +327,7 @@ No modules.
| [availability\_zone](#input\_availability\_zone) | Availability Zone for the cache cluster. If you want to create cache nodes in multi-az, use `preferred_availability_zones` instead | `string` | `null` | no |
| [az\_mode](#input\_az\_mode) | Whether the nodes in this Memcached node group are created in a single Availability Zone or created across multiple Availability Zones in the cluster's region. Valid values for this parameter are `single-az` or `cross-az`, default is `single-az` | `string` | `null` | no |
| [cluster\_id](#input\_cluster\_id) | Group identifier. ElastiCache converts this name to lowercase. Changing this value will re-create the resource | `string` | `""` | no |
+| [cluster\_mode](#input\_cluster\_mode) | Specifies whether cluster mode is enabled or disabled. Valid values are enabled or disabled or compatible | `string` | `null` | no |
| [cluster\_mode\_enabled](#input\_cluster\_mode\_enabled) | Whether to enable Redis [cluster mode https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/Replication.Redis-RedisCluster.html] | `bool` | `false` | no |
| [create](#input\_create) | Determines whether resources will be created (affects all resources) | `bool` | `true` | no |
| [create\_cluster](#input\_create\_cluster) | Determines whether an ElastiCache cluster will be created or not | `bool` | `false` | no |
diff --git a/examples/memcached-cluster/README.md b/examples/memcached-cluster/README.md
index 142e439..71fe41a 100644
--- a/examples/memcached-cluster/README.md
+++ b/examples/memcached-cluster/README.md
@@ -20,13 +20,13 @@ Note that this example may create resources which will incur monetary charges on
| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 1.0 |
-| [aws](#requirement\_aws) | >= 5.47 |
+| [aws](#requirement\_aws) | >= 5.71 |
## Providers
| Name | Version |
|------|---------|
-| [aws](#provider\_aws) | >= 5.47 |
+| [aws](#provider\_aws) | >= 5.71 |
## Modules
diff --git a/examples/memcached-cluster/versions.tf b/examples/memcached-cluster/versions.tf
index 407a955..0615775 100644
--- a/examples/memcached-cluster/versions.tf
+++ b/examples/memcached-cluster/versions.tf
@@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
- version = ">= 5.47"
+ version = ">= 5.71"
}
}
}
diff --git a/examples/redis-cluster-mode/README.md b/examples/redis-cluster-mode/README.md
index 5a837ac..9d1a578 100644
--- a/examples/redis-cluster-mode/README.md
+++ b/examples/redis-cluster-mode/README.md
@@ -22,13 +22,13 @@ Note that this example may create resources which will incur monetary charges on
| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 1.0 |
-| [aws](#requirement\_aws) | >= 5.47 |
+| [aws](#requirement\_aws) | >= 5.71 |
## Providers
| Name | Version |
|------|---------|
-| [aws](#provider\_aws) | >= 5.47 |
+| [aws](#provider\_aws) | >= 5.71 |
## Modules
diff --git a/examples/redis-cluster-mode/versions.tf b/examples/redis-cluster-mode/versions.tf
index 407a955..0615775 100644
--- a/examples/redis-cluster-mode/versions.tf
+++ b/examples/redis-cluster-mode/versions.tf
@@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
- version = ">= 5.47"
+ version = ">= 5.71"
}
}
}
diff --git a/examples/redis-cluster/README.md b/examples/redis-cluster/README.md
index e04cac3..1d3d4f4 100644
--- a/examples/redis-cluster/README.md
+++ b/examples/redis-cluster/README.md
@@ -20,13 +20,13 @@ Note that this example may create resources which will incur monetary charges on
| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 1.0 |
-| [aws](#requirement\_aws) | >= 5.47 |
+| [aws](#requirement\_aws) | >= 5.71 |
## Providers
| Name | Version |
|------|---------|
-| [aws](#provider\_aws) | >= 5.47 |
+| [aws](#provider\_aws) | >= 5.71 |
## Modules
diff --git a/examples/redis-cluster/versions.tf b/examples/redis-cluster/versions.tf
index 407a955..0615775 100644
--- a/examples/redis-cluster/versions.tf
+++ b/examples/redis-cluster/versions.tf
@@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
- version = ">= 5.47"
+ version = ">= 5.71"
}
}
}
diff --git a/examples/redis-global-replication-group/README.md b/examples/redis-global-replication-group/README.md
index 2a193ae..7ee97b6 100644
--- a/examples/redis-global-replication-group/README.md
+++ b/examples/redis-global-replication-group/README.md
@@ -24,14 +24,14 @@ Note that this example may create resources which will incur monetary charges on
| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 1.0 |
-| [aws](#requirement\_aws) | >= 5.47 |
+| [aws](#requirement\_aws) | >= 5.71 |
## Providers
| Name | Version |
|------|---------|
-| [aws](#provider\_aws) | >= 5.47 |
-| [aws.euwest1](#provider\_aws.euwest1) | >= 5.47 |
+| [aws](#provider\_aws) | >= 5.71 |
+| [aws.euwest1](#provider\_aws.euwest1) | >= 5.71 |
## Modules
diff --git a/examples/redis-global-replication-group/versions.tf b/examples/redis-global-replication-group/versions.tf
index 407a955..0615775 100644
--- a/examples/redis-global-replication-group/versions.tf
+++ b/examples/redis-global-replication-group/versions.tf
@@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
- version = ">= 5.47"
+ version = ">= 5.71"
}
}
}
diff --git a/examples/redis-replication-group-with-cluster-replica/README.md b/examples/redis-replication-group-with-cluster-replica/README.md
index 2f06f4c..7c3b025 100644
--- a/examples/redis-replication-group-with-cluster-replica/README.md
+++ b/examples/redis-replication-group-with-cluster-replica/README.md
@@ -20,13 +20,13 @@ Note that this example may create resources which will incur monetary charges on
| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 1.0 |
-| [aws](#requirement\_aws) | >= 5.47 |
+| [aws](#requirement\_aws) | >= 5.71 |
## Providers
| Name | Version |
|------|---------|
-| [aws](#provider\_aws) | >= 5.47 |
+| [aws](#provider\_aws) | >= 5.71 |
## Modules
diff --git a/examples/redis-replication-group-with-cluster-replica/versions.tf b/examples/redis-replication-group-with-cluster-replica/versions.tf
index 407a955..0615775 100644
--- a/examples/redis-replication-group-with-cluster-replica/versions.tf
+++ b/examples/redis-replication-group-with-cluster-replica/versions.tf
@@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
- version = ">= 5.47"
+ version = ">= 5.71"
}
}
}
diff --git a/examples/redis-replication-group/README.md b/examples/redis-replication-group/README.md
index 7d3e3ad..75d8720 100644
--- a/examples/redis-replication-group/README.md
+++ b/examples/redis-replication-group/README.md
@@ -20,13 +20,13 @@ Note that this example may create resources which will incur monetary charges on
| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 1.0 |
-| [aws](#requirement\_aws) | >= 5.47 |
+| [aws](#requirement\_aws) | >= 5.71 |
## Providers
| Name | Version |
|------|---------|
-| [aws](#provider\_aws) | >= 5.47 |
+| [aws](#provider\_aws) | >= 5.71 |
## Modules
diff --git a/examples/redis-replication-group/versions.tf b/examples/redis-replication-group/versions.tf
index 407a955..0615775 100644
--- a/examples/redis-replication-group/versions.tf
+++ b/examples/redis-replication-group/versions.tf
@@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
- version = ">= 5.47"
+ version = ">= 5.71"
}
}
}
diff --git a/examples/serverless-cache/main.tf b/examples/serverless-cache/main.tf
index aa29dd4..6516453 100644
--- a/examples/serverless-cache/main.tf
+++ b/examples/serverless-cache/main.tf
@@ -63,6 +63,9 @@ module "cache_user_group" {
authentication_mode = {
type = "no-password-required"
}
+ timeouts = {
+ create = "20m"
+ }
}
}
diff --git a/examples/serverless-cache/versions.tf b/examples/serverless-cache/versions.tf
index 407a955..0615775 100644
--- a/examples/serverless-cache/versions.tf
+++ b/examples/serverless-cache/versions.tf
@@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
- version = ">= 5.47"
+ version = ">= 5.71"
}
}
}
diff --git a/main.tf b/main.tf
index a4f6c95..f78027c 100644
--- a/main.tf
+++ b/main.tf
@@ -75,6 +75,7 @@ resource "aws_elasticache_replication_group" "this" {
auth_token_update_strategy = var.auth_token_update_strategy
auto_minor_version_upgrade = var.auto_minor_version_upgrade
automatic_failover_enabled = var.multi_az_enabled || var.cluster_mode_enabled ? true : var.automatic_failover_enabled
+ cluster_mode = var.cluster_mode
data_tiering_enabled = var.data_tiering_enabled
description = coalesce(var.description, "Replication group")
engine = var.engine
@@ -152,6 +153,7 @@ resource "aws_elasticache_replication_group" "global" {
auth_token_update_strategy = var.auth_token_update_strategy
auto_minor_version_upgrade = var.auto_minor_version_upgrade
automatic_failover_enabled = var.multi_az_enabled || var.cluster_mode_enabled ? true : var.automatic_failover_enabled
+ cluster_mode = var.cluster_mode
data_tiering_enabled = var.data_tiering_enabled
description = coalesce(var.description, "Global replication group")
engine = var.create_secondary_global_replication_group ? null : var.engine
diff --git a/modules/serverless-cache/README.md b/modules/serverless-cache/README.md
index c4860b1..e4605fb 100644
--- a/modules/serverless-cache/README.md
+++ b/modules/serverless-cache/README.md
@@ -60,13 +60,13 @@ Examples codified under the [`examples`](https://github.com/terraform-aws-module
| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 1.0 |
-| [aws](#requirement\_aws) | >= 5.47 |
+| [aws](#requirement\_aws) | >= 5.71 |
## Providers
| Name | Version |
|------|---------|
-| [aws](#provider\_aws) | >= 5.47 |
+| [aws](#provider\_aws) | >= 5.71 |
## Modules
diff --git a/modules/serverless-cache/versions.tf b/modules/serverless-cache/versions.tf
index 407a955..0615775 100644
--- a/modules/serverless-cache/versions.tf
+++ b/modules/serverless-cache/versions.tf
@@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
- version = ">= 5.47"
+ version = ">= 5.71"
}
}
}
diff --git a/modules/user-group/README.md b/modules/user-group/README.md
index 743fd4e..b1584fe 100644
--- a/modules/user-group/README.md
+++ b/modules/user-group/README.md
@@ -66,13 +66,13 @@ Examples codified under the [`examples`](https://github.com/terraform-aws-module
| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 1.0 |
-| [aws](#requirement\_aws) | >= 5.47 |
+| [aws](#requirement\_aws) | >= 5.71 |
## Providers
| Name | Version |
|------|---------|
-| [aws](#provider\_aws) | >= 5.47 |
+| [aws](#provider\_aws) | >= 5.71 |
## Modules
diff --git a/modules/user-group/main.tf b/modules/user-group/main.tf
index 7919fb7..d21e509 100644
--- a/modules/user-group/main.tf
+++ b/modules/user-group/main.tf
@@ -74,4 +74,12 @@ resource "aws_elasticache_user_group_association" "this" {
user_group_id = var.create && var.create_group ? aws_elasticache_user_group.this[0].user_group_id : each.value.user_group_id
user_id = aws_elasticache_user.this[each.key].user_id
+
+ dynamic "timeouts" {
+ for_each = try([each.value.timeouts], [])
+ content {
+ create = try(timeouts.value.create, null)
+ delete = try(timeouts.value.delete, null)
+ }
+ }
}
diff --git a/modules/user-group/versions.tf b/modules/user-group/versions.tf
index 407a955..0615775 100644
--- a/modules/user-group/versions.tf
+++ b/modules/user-group/versions.tf
@@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
- version = ">= 5.47"
+ version = ">= 5.71"
}
}
}
diff --git a/variables.tf b/variables.tf
index 2ff4aff..59649be 100644
--- a/variables.tf
+++ b/variables.tf
@@ -269,6 +269,12 @@ variable "replicas_per_node_group" {
default = null
}
+variable "cluster_mode" {
+ description = "Specifies whether cluster mode is enabled or disabled. Valid values are enabled or disabled or compatible"
+ type = string
+ default = null
+}
+
variable "replication_group_id" {
description = "Replication group identifier. When `create_replication_group` is set to `true`, this is the ID assigned to the replication group created. When `create_replication_group` is set to `false`, this is the ID of an externally created replication group"
type = string
diff --git a/versions.tf b/versions.tf
index 7cd9c04..0bf905c 100644
--- a/versions.tf
+++ b/versions.tf
@@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
- version = ">= 5.47"
+ version = ">= 5.71"
}
random = {
source = "hashicorp/random"