From cdc870e425fd34a93f3e38adccf8eb4c8fd1ef1a Mon Sep 17 00:00:00 2001 From: ottramst Date: Mon, 2 Dec 2024 16:55:45 +0200 Subject: [PATCH 1/6] fix: Change cloudwatch log group output to include all created log groups (#19) --- README.md | 1 + examples/memcached-cluster/README.md | 3 +-- examples/memcached-cluster/outputs.tf | 11 +++-------- examples/redis-cluster-mode/README.md | 3 +-- examples/redis-cluster-mode/outputs.tf | 11 +++-------- examples/redis-cluster/README.md | 3 +-- examples/redis-cluster/outputs.tf | 11 +++-------- examples/redis-global-replication-group/README.md | 3 +-- examples/redis-global-replication-group/outputs.tf | 11 +++-------- .../README.md | 3 +-- .../outputs.tf | 11 +++-------- examples/redis-replication-group/README.md | 3 +-- examples/redis-replication-group/outputs.tf | 11 +++-------- outputs.tf | 7 +++++++ 14 files changed, 32 insertions(+), 60 deletions(-) diff --git a/README.md b/README.md index e422a35..9cea7db 100644 --- a/README.md +++ b/README.md @@ -473,6 +473,7 @@ No modules. |------|-------------| | [cloudwatch\_log\_group\_arn](#output\_cloudwatch\_log\_group\_arn) | Arn of cloudwatch log group created | | [cloudwatch\_log\_group\_name](#output\_cloudwatch\_log\_group\_name) | Name of cloudwatch log group created | +| [cloudwatch\_log\_groups](#output\_cloudwatch\_log\_groups) | Map of CloudWatch log groups created and their attributes | | [cluster\_address](#output\_cluster\_address) | (Memcached only) DNS name of the cache cluster without the port appended | | [cluster\_arn](#output\_cluster\_arn) | The ARN of the ElastiCache Cluster | | [cluster\_cache\_nodes](#output\_cluster\_cache\_nodes) | List of node objects including `id`, `address`, `port` and `availability_zone` | diff --git a/examples/memcached-cluster/README.md b/examples/memcached-cluster/README.md index 16ced47..7c93f16 100644 --- a/examples/memcached-cluster/README.md +++ b/examples/memcached-cluster/README.md @@ -50,8 +50,7 @@ No inputs. | Name | Description | |------|-------------| -| [cloudwatch\_log\_group\_arn](#output\_cloudwatch\_log\_group\_arn) | Arn of cloudwatch log group created | -| [cloudwatch\_log\_group\_name](#output\_cloudwatch\_log\_group\_name) | Name of cloudwatch log group created | +| [cloudwatch\_log\_groups](#output\_cloudwatch\_log\_groups) | Map of CloudWatch log groups created and their attributes | | [cluster\_address](#output\_cluster\_address) | (Memcached only) DNS name of the cache cluster without the port appended | | [cluster\_arn](#output\_cluster\_arn) | The ARN of the ElastiCache Cluster | | [cluster\_cache\_nodes](#output\_cluster\_cache\_nodes) | List of node objects including `id`, `address`, `port` and `availability_zone` | diff --git a/examples/memcached-cluster/outputs.tf b/examples/memcached-cluster/outputs.tf index a3a563b..ccf51c7 100644 --- a/examples/memcached-cluster/outputs.tf +++ b/examples/memcached-cluster/outputs.tf @@ -94,14 +94,9 @@ output "global_replication_group_node_groups" { # CloudWatch Log Group ################################################################################ -output "cloudwatch_log_group_name" { - description = "Name of cloudwatch log group created" - value = module.elasticache.cloudwatch_log_group_name -} - -output "cloudwatch_log_group_arn" { - description = "Arn of cloudwatch log group created" - value = module.elasticache.cloudwatch_log_group_arn +output "cloudwatch_log_groups" { + description = "Map of CloudWatch log groups created and their attributes" + value = module.elasticache.cloudwatch_log_groups } ################################################################################ diff --git a/examples/redis-cluster-mode/README.md b/examples/redis-cluster-mode/README.md index 9bc003f..8453466 100644 --- a/examples/redis-cluster-mode/README.md +++ b/examples/redis-cluster-mode/README.md @@ -52,8 +52,7 @@ No inputs. | Name | Description | |------|-------------| -| [cloudwatch\_log\_group\_arn](#output\_cloudwatch\_log\_group\_arn) | Arn of cloudwatch log group created | -| [cloudwatch\_log\_group\_name](#output\_cloudwatch\_log\_group\_name) | Name of cloudwatch log group created | +| [cloudwatch\_log\_groups](#output\_cloudwatch\_log\_groups) | Map of CloudWatch log groups created and their attributes | | [cluster\_address](#output\_cluster\_address) | (Memcached only) DNS name of the cache cluster without the port appended | | [cluster\_arn](#output\_cluster\_arn) | The ARN of the ElastiCache Cluster | | [cluster\_cache\_nodes](#output\_cluster\_cache\_nodes) | List of node objects including `id`, `address`, `port` and `availability_zone` | diff --git a/examples/redis-cluster-mode/outputs.tf b/examples/redis-cluster-mode/outputs.tf index a3a563b..ccf51c7 100644 --- a/examples/redis-cluster-mode/outputs.tf +++ b/examples/redis-cluster-mode/outputs.tf @@ -94,14 +94,9 @@ output "global_replication_group_node_groups" { # CloudWatch Log Group ################################################################################ -output "cloudwatch_log_group_name" { - description = "Name of cloudwatch log group created" - value = module.elasticache.cloudwatch_log_group_name -} - -output "cloudwatch_log_group_arn" { - description = "Arn of cloudwatch log group created" - value = module.elasticache.cloudwatch_log_group_arn +output "cloudwatch_log_groups" { + description = "Map of CloudWatch log groups created and their attributes" + value = module.elasticache.cloudwatch_log_groups } ################################################################################ diff --git a/examples/redis-cluster/README.md b/examples/redis-cluster/README.md index 19b1c33..7afc24d 100644 --- a/examples/redis-cluster/README.md +++ b/examples/redis-cluster/README.md @@ -50,8 +50,7 @@ No inputs. | Name | Description | |------|-------------| -| [cloudwatch\_log\_group\_arn](#output\_cloudwatch\_log\_group\_arn) | Arn of cloudwatch log group created | -| [cloudwatch\_log\_group\_name](#output\_cloudwatch\_log\_group\_name) | Name of cloudwatch log group created | +| [cloudwatch\_log\_groups](#output\_cloudwatch\_log\_groups) | Map of CloudWatch log groups created and their attributes | | [cluster\_address](#output\_cluster\_address) | (Memcached only) DNS name of the cache cluster without the port appended | | [cluster\_arn](#output\_cluster\_arn) | The ARN of the ElastiCache Cluster | | [cluster\_cache\_nodes](#output\_cluster\_cache\_nodes) | List of node objects including `id`, `address`, `port` and `availability_zone` | diff --git a/examples/redis-cluster/outputs.tf b/examples/redis-cluster/outputs.tf index a3a563b..ccf51c7 100644 --- a/examples/redis-cluster/outputs.tf +++ b/examples/redis-cluster/outputs.tf @@ -94,14 +94,9 @@ output "global_replication_group_node_groups" { # CloudWatch Log Group ################################################################################ -output "cloudwatch_log_group_name" { - description = "Name of cloudwatch log group created" - value = module.elasticache.cloudwatch_log_group_name -} - -output "cloudwatch_log_group_arn" { - description = "Arn of cloudwatch log group created" - value = module.elasticache.cloudwatch_log_group_arn +output "cloudwatch_log_groups" { + description = "Map of CloudWatch log groups created and their attributes" + value = module.elasticache.cloudwatch_log_groups } ################################################################################ diff --git a/examples/redis-global-replication-group/README.md b/examples/redis-global-replication-group/README.md index 369e352..f512f47 100644 --- a/examples/redis-global-replication-group/README.md +++ b/examples/redis-global-replication-group/README.md @@ -57,8 +57,7 @@ No inputs. | Name | Description | |------|-------------| -| [cloudwatch\_log\_group\_arn](#output\_cloudwatch\_log\_group\_arn) | Arn of cloudwatch log group created | -| [cloudwatch\_log\_group\_name](#output\_cloudwatch\_log\_group\_name) | Name of cloudwatch log group created | +| [cloudwatch\_log\_groups](#output\_cloudwatch\_log\_groups) | Map of CloudWatch log groups created and their attributes | | [cluster\_address](#output\_cluster\_address) | (Memcached only) DNS name of the cache cluster without the port appended | | [cluster\_arn](#output\_cluster\_arn) | The ARN of the ElastiCache Cluster | | [cluster\_cache\_nodes](#output\_cluster\_cache\_nodes) | List of node objects including `id`, `address`, `port` and `availability_zone` | diff --git a/examples/redis-global-replication-group/outputs.tf b/examples/redis-global-replication-group/outputs.tf index 45505ae..85300ce 100644 --- a/examples/redis-global-replication-group/outputs.tf +++ b/examples/redis-global-replication-group/outputs.tf @@ -94,14 +94,9 @@ output "global_replication_group_node_groups" { # CloudWatch Log Group ################################################################################ -output "cloudwatch_log_group_name" { - description = "Name of cloudwatch log group created" - value = module.elasticache_primary.cloudwatch_log_group_name -} - -output "cloudwatch_log_group_arn" { - description = "Arn of cloudwatch log group created" - value = module.elasticache_primary.cloudwatch_log_group_arn +output "cloudwatch_log_groups" { + description = "Map of CloudWatch log groups created and their attributes" + value = module.elasticache_primary.cloudwatch_log_groups } ################################################################################ diff --git a/examples/redis-replication-group-with-cluster-replica/README.md b/examples/redis-replication-group-with-cluster-replica/README.md index 7f62c8a..48f8674 100644 --- a/examples/redis-replication-group-with-cluster-replica/README.md +++ b/examples/redis-replication-group-with-cluster-replica/README.md @@ -51,8 +51,7 @@ No inputs. | Name | Description | |------|-------------| -| [cloudwatch\_log\_group\_arn](#output\_cloudwatch\_log\_group\_arn) | Arn of cloudwatch log group created | -| [cloudwatch\_log\_group\_name](#output\_cloudwatch\_log\_group\_name) | Name of cloudwatch log group created | +| [cloudwatch\_log\_groups](#output\_cloudwatch\_log\_groups) | Map of CloudWatch log groups created and their attributes | | [cluster\_address](#output\_cluster\_address) | (Memcached only) DNS name of the cache cluster without the port appended | | [cluster\_arn](#output\_cluster\_arn) | The ARN of the ElastiCache Cluster | | [cluster\_cache\_nodes](#output\_cluster\_cache\_nodes) | List of node objects including `id`, `address`, `port` and `availability_zone` | diff --git a/examples/redis-replication-group-with-cluster-replica/outputs.tf b/examples/redis-replication-group-with-cluster-replica/outputs.tf index b1e108b..c649115 100644 --- a/examples/redis-replication-group-with-cluster-replica/outputs.tf +++ b/examples/redis-replication-group-with-cluster-replica/outputs.tf @@ -94,14 +94,9 @@ output "global_replication_group_node_groups" { # CloudWatch Log Group ################################################################################ -output "cloudwatch_log_group_name" { - description = "Name of cloudwatch log group created" - value = module.replication_group_with_cluster_replica.cloudwatch_log_group_name -} - -output "cloudwatch_log_group_arn" { - description = "Arn of cloudwatch log group created" - value = module.replication_group_with_cluster_replica.cloudwatch_log_group_arn +output "cloudwatch_log_groups" { + description = "Map of CloudWatch log groups created and their attributes" + value = module.replication_group_with_cluster_replica.cloudwatch_log_groups } ################################################################################ diff --git a/examples/redis-replication-group/README.md b/examples/redis-replication-group/README.md index 237289b..e4e2312 100644 --- a/examples/redis-replication-group/README.md +++ b/examples/redis-replication-group/README.md @@ -49,8 +49,7 @@ No inputs. | Name | Description | |------|-------------| -| [cloudwatch\_log\_group\_arn](#output\_cloudwatch\_log\_group\_arn) | Arn of cloudwatch log group created | -| [cloudwatch\_log\_group\_name](#output\_cloudwatch\_log\_group\_name) | Name of cloudwatch log group created | +| [cloudwatch\_log\_groups](#output\_cloudwatch\_log\_groups) | Map of CloudWatch log groups created and their attributes | | [cluster\_address](#output\_cluster\_address) | (Memcached only) DNS name of the cache cluster without the port appended | | [cluster\_arn](#output\_cluster\_arn) | The ARN of the ElastiCache Cluster | | [cluster\_cache\_nodes](#output\_cluster\_cache\_nodes) | List of node objects including `id`, `address`, `port` and `availability_zone` | diff --git a/examples/redis-replication-group/outputs.tf b/examples/redis-replication-group/outputs.tf index a3a563b..ccf51c7 100644 --- a/examples/redis-replication-group/outputs.tf +++ b/examples/redis-replication-group/outputs.tf @@ -94,14 +94,9 @@ output "global_replication_group_node_groups" { # CloudWatch Log Group ################################################################################ -output "cloudwatch_log_group_name" { - description = "Name of cloudwatch log group created" - value = module.elasticache.cloudwatch_log_group_name -} - -output "cloudwatch_log_group_arn" { - description = "Arn of cloudwatch log group created" - value = module.elasticache.cloudwatch_log_group_arn +output "cloudwatch_log_groups" { + description = "Map of CloudWatch log groups created and their attributes" + value = module.elasticache.cloudwatch_log_groups } ################################################################################ diff --git a/outputs.tf b/outputs.tf index 2b4cf6f..e015a78 100644 --- a/outputs.tf +++ b/outputs.tf @@ -94,11 +94,18 @@ output "global_replication_group_node_groups" { # CloudWatch Log Group ################################################################################ +output "cloudwatch_log_groups" { + description = "Map of CloudWatch log groups created and their attributes" + value = aws_cloudwatch_log_group.this +} + +# TODO - remove at next breaking change output "cloudwatch_log_group_name" { description = "Name of cloudwatch log group created" value = try(aws_cloudwatch_log_group.this[0].name, null) } +# TODO - remove at next breaking change output "cloudwatch_log_group_arn" { description = "Arn of cloudwatch log group created" value = try(aws_cloudwatch_log_group.this[0].arn, null) From 7d8b70b6c1cf4f4e1bd635caf413ce8623c98706 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Mon, 2 Dec 2024 14:56:11 +0000 Subject: [PATCH 2/6] chore(release): version 1.4.1 [skip ci] ## [1.4.1](https://github.com/terraform-aws-modules/terraform-aws-elasticache/compare/v1.4.0...v1.4.1) (2024-12-02) ### Bug Fixes * Change cloudwatch log group output to include all created log groups ([#19](https://github.com/terraform-aws-modules/terraform-aws-elasticache/issues/19)) ([cdc870e](https://github.com/terraform-aws-modules/terraform-aws-elasticache/commit/cdc870e425fd34a93f3e38adccf8eb4c8fd1ef1a)) --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f4710f..7e4b3bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to this project will be documented in this file. +## [1.4.1](https://github.com/terraform-aws-modules/terraform-aws-elasticache/compare/v1.4.0...v1.4.1) (2024-12-02) + + +### Bug Fixes + +* Change cloudwatch log group output to include all created log groups ([#19](https://github.com/terraform-aws-modules/terraform-aws-elasticache/issues/19)) ([cdc870e](https://github.com/terraform-aws-modules/terraform-aws-elasticache/commit/cdc870e425fd34a93f3e38adccf8eb4c8fd1ef1a)) + ## [1.4.0](https://github.com/terraform-aws-modules/terraform-aws-elasticache/compare/v1.3.0...v1.4.0) (2024-11-29) From 41e5c75b2ea15a8631f8bb9f7f73ad5d868eeddf Mon Sep 17 00:00:00 2001 From: Melissa Greenbaum <69476188+magreenbaum@users.noreply.github.com> Date: Sat, 29 Mar 2025 09:49:21 -0400 Subject: [PATCH 3/6] feat: Add elasticache cluster timeouts (#33) --- README.md | 5 +++-- examples/redis-cluster/main.tf | 6 ++++++ main.tf | 6 ++++++ variables.tf | 6 ++++++ versions.tf | 2 +- 5 files changed, 22 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9cea7db..e437ed6 100644 --- a/README.md +++ b/README.md @@ -366,14 +366,14 @@ Examples codified under the [`examples`](https://github.com/terraform-aws-module | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 5.73 | +| [aws](#requirement\_aws) | >= 5.93 | | [random](#requirement\_random) | >= 3.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 5.73 | +| [aws](#provider\_aws) | >= 5.93 | | [random](#provider\_random) | >= 3.0 | ## Modules @@ -462,6 +462,7 @@ No modules. | [subnet\_group\_name](#input\_subnet\_group\_name) | The name of the subnet group. If `create_subnet_group` is `true`, this is the name assigned to the subnet group created. Otherwise, this is the name of an existing subnet group | `string` | `null` | no | | [subnet\_ids](#input\_subnet\_ids) | List of VPC Subnet IDs for the Elasticache subnet group | `list(string)` | `[]` | no | | [tags](#input\_tags) | A map of tags to add to all resources | `map(string)` | `{}` | no | +| [timeouts](#input\_timeouts) | Define maximum timeout for creating, updating, and deleting cluster resource | `map(string)` | `{}` | no | | [transit\_encryption\_enabled](#input\_transit\_encryption\_enabled) | Enable encryption in-transit. Supported only with Memcached versions `1.6.12` and later, running in a VPC | `bool` | `true` | no | | [transit\_encryption\_mode](#input\_transit\_encryption\_mode) | A setting that enables clients to migrate to in-transit encryption with no downtime. Valid values are preferred and required | `string` | `null` | no | | [user\_group\_ids](#input\_user\_group\_ids) | User Group ID to associate with the replication group. Only a maximum of one (1) user group ID is valid | `list(string)` | `null` | no | diff --git a/examples/redis-cluster/main.tf b/examples/redis-cluster/main.tf index d2fa6fc..9e1e504 100644 --- a/examples/redis-cluster/main.tf +++ b/examples/redis-cluster/main.tf @@ -64,6 +64,12 @@ module "elasticache" { ] tags = local.tags + + timeouts = { + create = "1h" + update = "2h" + delete = "1h" + } } module "elasticache_disabled" { diff --git a/main.tf b/main.tf index 69a3b9b..4097459 100644 --- a/main.tf +++ b/main.tf @@ -61,6 +61,12 @@ resource "aws_elasticache_cluster" "this" { transit_encryption_enabled = var.engine == "memcached" ? var.transit_encryption_enabled : null tags = local.tags + + timeouts { + create = try(var.timeouts.create, null) + update = try(var.timeouts.update, null) + delete = try(var.timeouts.delete, null) + } } ################################################################################ diff --git a/variables.tf b/variables.tf index 55b36ba..f4049d6 100644 --- a/variables.tf +++ b/variables.tf @@ -187,6 +187,12 @@ variable "transit_encryption_mode" { default = null } +variable "timeouts" { + description = "Define maximum timeout for creating, updating, and deleting cluster resource" + type = map(string) + default = {} +} + ################################################################################ # Replication Group ################################################################################ diff --git a/versions.tf b/versions.tf index 648b57a..6dda813 100644 --- a/versions.tf +++ b/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 5.73" + version = ">= 5.93" } random = { source = "hashicorp/random" From 5ebac98382eabce381e84cc478235f81005c11d7 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sat, 29 Mar 2025 13:49:45 +0000 Subject: [PATCH 4/6] chore(release): version 1.5.0 [skip ci] ## [1.5.0](https://github.com/terraform-aws-modules/terraform-aws-elasticache/compare/v1.4.1...v1.5.0) (2025-03-29) ### Features * Add elasticache cluster timeouts ([#33](https://github.com/terraform-aws-modules/terraform-aws-elasticache/issues/33)) ([41e5c75](https://github.com/terraform-aws-modules/terraform-aws-elasticache/commit/41e5c75b2ea15a8631f8bb9f7f73ad5d868eeddf)) --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e4b3bc..1b71d98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to this project will be documented in this file. +## [1.5.0](https://github.com/terraform-aws-modules/terraform-aws-elasticache/compare/v1.4.1...v1.5.0) (2025-03-29) + + +### Features + +* Add elasticache cluster timeouts ([#33](https://github.com/terraform-aws-modules/terraform-aws-elasticache/issues/33)) ([41e5c75](https://github.com/terraform-aws-modules/terraform-aws-elasticache/commit/41e5c75b2ea15a8631f8bb9f7f73ad5d868eeddf)) + ## [1.4.1](https://github.com/terraform-aws-modules/terraform-aws-elasticache/compare/v1.4.0...v1.4.1) (2024-12-02) From 9133f1ec80c4cefef8dd5a763f6f6d9e4526276e Mon Sep 17 00:00:00 2001 From: Alisson Ramos de Oliveira <13340485+alisson276@users.noreply.github.com> Date: Sun, 30 Mar 2025 15:10:13 +0100 Subject: [PATCH 5/6] feat: Set `create_before_destroy` on subnet group (#29) Co-authored-by: Bryant Biggs --- main.tf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main.tf b/main.tf index 4097459..98cbbb0 100644 --- a/main.tf +++ b/main.tf @@ -292,6 +292,10 @@ resource "aws_elasticache_subnet_group" "this" { subnet_ids = var.subnet_ids tags = local.tags + + lifecycle { + create_before_destroy = true + } } ################################################################################ From d10bc362c93de62971a78d243aa4d00f66cf59c2 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sun, 30 Mar 2025 14:10:34 +0000 Subject: [PATCH 6/6] chore(release): version 1.6.0 [skip ci] ## [1.6.0](https://github.com/terraform-aws-modules/terraform-aws-elasticache/compare/v1.5.0...v1.6.0) (2025-03-30) ### Features * Set `create_before_destroy` on subnet group ([#29](https://github.com/terraform-aws-modules/terraform-aws-elasticache/issues/29)) ([9133f1e](https://github.com/terraform-aws-modules/terraform-aws-elasticache/commit/9133f1ec80c4cefef8dd5a763f6f6d9e4526276e)) --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b71d98..afcc12d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to this project will be documented in this file. +## [1.6.0](https://github.com/terraform-aws-modules/terraform-aws-elasticache/compare/v1.5.0...v1.6.0) (2025-03-30) + + +### Features + +* Set `create_before_destroy` on subnet group ([#29](https://github.com/terraform-aws-modules/terraform-aws-elasticache/issues/29)) ([9133f1e](https://github.com/terraform-aws-modules/terraform-aws-elasticache/commit/9133f1ec80c4cefef8dd5a763f6f6d9e4526276e)) + ## [1.5.0](https://github.com/terraform-aws-modules/terraform-aws-elasticache/compare/v1.4.1...v1.5.0) (2025-03-29)