From 0fc5ed8a713f4f2c6dfd74c285c1cf9781d9461e Mon Sep 17 00:00:00 2001 From: xshot9011 <40098197+xshot9011@users.noreply.github.com> Date: Thu, 8 Jun 2023 16:07:47 +0700 Subject: [PATCH 1/4] chore: limit aws provider version --- versions.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions.tf b/versions.tf index c0f2da4..584fae6 100644 --- a/versions.tf +++ b/versions.tf @@ -2,8 +2,8 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.0.0" + version = ">= 5.0.0, < 6.0.0" } } - required_version = ">= 1.1.1" + required_version = ">= 1.0.0" } From 88f4f00361bec2e2a8db921256e3906e46967bed Mon Sep 17 00:00:00 2001 From: xshot9011 <40098197+xshot9011@users.noreply.github.com> Date: Thu, 8 Jun 2023 17:58:28 +0700 Subject: [PATCH 2/4] chore: remove deprecated variables --- main.tf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.tf b/main.tf index ce32c6e..e16fb8b 100644 --- a/main.tf +++ b/main.tf @@ -23,9 +23,9 @@ resource "aws_elasticache_replication_group" "elasticache" { engine_version = var.redis_cluster_config.engine_version # Subnets, AZs & Security - subnet_group_name = aws_elasticache_subnet_group.elasticache.name - availability_zones = data.aws_subnet.subnets.*.availability_zone - security_group_ids = [aws_security_group.elasticache.id] + subnet_group_name = aws_elasticache_subnet_group.elasticache.name + preferred_cache_cluster_azs = data.aws_subnet.subnets.*.availability_zone + security_group_ids = [aws_security_group.elasticache.id] # HA num_cache_clusters = var.redis_cluster_config.node_count From 16f7c11f9ebeab1374946201ce4bba8eb073dbf7 Mon Sep 17 00:00:00 2001 From: xshot9011 <40098197+xshot9011@users.noreply.github.com> Date: Thu, 8 Jun 2023 18:19:26 +0700 Subject: [PATCH 3/4] choer: update elasticahce alarms --- alarms.tf | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/alarms.tf b/alarms.tf index 9f8aa74..4cdeb9d 100644 --- a/alarms.tf +++ b/alarms.tf @@ -1,8 +1,8 @@ module "custom_elasticache_alarms" { source = "oozou/cloudwatch-alarm/aws" - version = "1.0.0" + version = "2.0.0" - for_each = var.custom_elasticache_alarms_configure + for_each = var.custom_elasticache_alarms_configure depends_on = [aws_elasticache_replication_group.elasticache] prefix = var.prefix @@ -32,13 +32,13 @@ module "custom_elasticache_alarms" { } alarm_actions = lookup(each.value, "alarm_actions", null) - ok_actions = lookup(each.value, "ok_actions", null) + ok_actions = lookup(each.value, "ok_actions", null) tags = local.tags } resource "aws_cloudwatch_metric_alarm" "redis_cpu_alarm" { - count = var.is_enable_default_alarms ? 1 : 0 + count = var.is_enable_default_alarms ? 1 : 0 alarm_name = format("%s-%s-alarm", local.service_name, "redis_high_CPU") comparison_operator = "GreaterThanThreshold" evaluation_periods = "1" @@ -58,7 +58,7 @@ resource "aws_cloudwatch_metric_alarm" "redis_cpu_alarm" { } resource "aws_cloudwatch_metric_alarm" "redis_memory_alarm" { - count = var.is_enable_default_alarms ? 1 : 0 + count = var.is_enable_default_alarms ? 1 : 0 alarm_name = format("%s-%s-alarm", local.service_name, "redis_high_memory") comparison_operator = "GreaterThanThreshold" evaluation_periods = "1" From 41a584d1e24ada2c0f764557aec004b270963156 Mon Sep 17 00:00:00 2001 From: xshot9011 <40098197+xshot9011@users.noreply.github.com> Date: Thu, 8 Jun 2023 18:49:01 +0700 Subject: [PATCH 4/4] chore: update README and CHANGELOG --- CHANGELOG.md | 7 ++++ README.md | 90 ++++++++++++++++++++++++++-------------------------- 2 files changed, 52 insertions(+), 45 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c8f846..0cc83c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to this module will be documented in this file. +## [v2.0.0] - 2023-06-08 + +### BREAKING CHANGES + +- Upgrade the AWS provider to version 5 with the constraint of `>= 5.0.0, < 6.0.0`. + + ## [v1.0.2] - 2022-12-22 ### Added diff --git a/README.md b/README.md index 1088537..3eab422 100644 --- a/README.md +++ b/README.md @@ -62,63 +62,63 @@ module "elasticache_cluster" { ## Requirements -| Name | Version | -|------|---------| -| [terraform](#requirement\_terraform) | >= 1.1.1 | -| [aws](#requirement\_aws) | >= 4.0.0 | +| Name | Version | +|---------------------------------------------------------------------------|-------------------| +| [terraform](#requirement\_terraform) | >= 1.0.0 | +| [aws](#requirement\_aws) | >= 5.0.0, < 6.0.0 | ## Providers -| Name | Version | -|------|---------| -| [aws](#provider\_aws) | >= 4.0.0 | +| Name | Version | +|---------------------------------------------------|---------| +| [aws](#provider\_aws) | 5.1.0 | ## Modules -| Name | Source | Version | -|------|--------|---------| -| [custom\_elasticache\_alarms](#module\_custom\_elasticache\_alarms) | oozou/cloudwatch-alarm/aws | 1.0.0 | +| Name | Source | Version | +|---------------------------------------------------------------------------------------------------------------------|----------------------------|---------| +| [custom\_elasticache\_alarms](#module\_custom\_elasticache\_alarms) | oozou/cloudwatch-alarm/aws | 2.0.0 | ## Resources -| Name | Type | -|------|------| -| [aws_cloudwatch_metric_alarm.redis_cpu_alarm](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_metric_alarm) | resource | -| [aws_cloudwatch_metric_alarm.redis_memory_alarm](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_metric_alarm) | resource | -| [aws_elasticache_replication_group.elasticache](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/elasticache_replication_group) | resource | -| [aws_elasticache_subnet_group.elasticache](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/elasticache_subnet_group) | resource | -| [aws_security_group.client](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group) | resource | -| [aws_security_group.elasticache](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group) | resource | -| [aws_security_group_rule.additional_cluster_ingress](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule) | resource | -| [aws_security_group_rule.egress](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule) | resource | -| [aws_security_group_rule.ingress](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule) | resource | -| [aws_subnet.subnets](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnet) | data source | +| Name | Type | +|------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------| +| [aws_cloudwatch_metric_alarm.redis_cpu_alarm](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_metric_alarm) | resource | +| [aws_cloudwatch_metric_alarm.redis_memory_alarm](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_metric_alarm) | resource | +| [aws_elasticache_replication_group.elasticache](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/elasticache_replication_group) | resource | +| [aws_elasticache_subnet_group.elasticache](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/elasticache_subnet_group) | resource | +| [aws_security_group.client](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group) | resource | +| [aws_security_group.elasticache](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group) | resource | +| [aws_security_group_rule.additional_cluster_ingress](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule) | resource | +| [aws_security_group_rule.egress](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule) | resource | +| [aws_security_group_rule.ingress](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule) | resource | +| [aws_subnet.subnets](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnet) | data source | ## Inputs -| Name | Description | Type | Default | Required | -|------|-------------|------|---------|:--------:| -| [additional\_cluster\_security\_group\_ingress\_rules](#input\_additional\_cluster\_security\_group\_ingress\_rules) | Additional ingress rule for cluster security group. |
list(object({| `[]` | no | -| [auth\_token](#input\_auth\_token) | Auth token for the Elasticache redis auth. Reference: https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/auth.html | `string` | n/a | yes | -| [custom\_elasticache\_alarms\_configure](#input\_custom\_elasticache\_alarms\_configure) | custom\_elasticache\_alarms\_configure = {
from_port = number
to_port = number
protocol = string
cidr_blocks = list(string)
source_security_group_id = string
description = string
}))
object({| n/a | yes | -| [snapshot\_config](#input\_snapshot\_config) | (optional) Snapshot config to retain and create backup |
port = number
instance_type = string
engine_version = string
node_count = number
})
object({|
snapshot_window = string
snapshot_retention_limit = number
})
{| no | -| [tags](#input\_tags) | Custom tags which can be passed on to the AWS resources. They should be key value pairs having distinct keys. | `map(string)` | `{}` | no | -| [vpc\_config](#input\_vpc\_config) | VPC ID and private subnets for ElastiCache cluster |
"snapshot_retention_limit": 3,
"snapshot_window": "03:00-05:00"
}
object({| n/a | yes | +| Name | Description | Type | Default | Required | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------|:--------:| +| [additional\_cluster\_security\_group\_ingress\_rules](#input\_additional\_cluster\_security\_group\_ingress\_rules) | Additional ingress rule for cluster security group. |
vpc_id = string
private_subnets = list(string)
})
list(object({| `[]` | no | +| [auth\_token](#input\_auth\_token) | Auth token for the Elasticache redis auth. Reference: https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/auth.html | `string` | n/a | yes | +| [custom\_elasticache\_alarms\_configure](#input\_custom\_elasticache\_alarms\_configure) | custom\_elasticache\_alarms\_configure = {
from_port = number
to_port = number
protocol = string
cidr_blocks = list(string)
source_security_group_id = string
description = string
}))
object({| n/a | yes | +| [snapshot\_config](#input\_snapshot\_config) | (optional) Snapshot config to retain and create backup |
port = number
instance_type = string
engine_version = string
node_count = number
})
object({|
snapshot_window = string
snapshot_retention_limit = number
})
{| no | +| [tags](#input\_tags) | Custom tags which can be passed on to the AWS resources. They should be key value pairs having distinct keys. | `map(string)` | `{}` | no | +| [vpc\_config](#input\_vpc\_config) | VPC ID and private subnets for ElastiCache cluster |
"snapshot_retention_limit": 3,
"snapshot_window": "03:00-05:00"
}
object({| n/a | yes | ## Outputs -| Name | Description | -|------|-------------| -| [client\_security\_group\_id](#output\_client\_security\_group\_id) | Security group id for the elasticache clients. | -| [redis\_host](#output\_redis\_host) | Hostname of the redis host in the replication group. | -| [security\_group\_id](#output\_security\_group\_id) | Security group id for the elasticache. | - \ No newline at end of file +| Name | Description | +|--------------------------------------------------------------------------------------------------------------------|------------------------------------------------------| +| [client\_security\_group\_id](#output\_client\_security\_group\_id) | Security group id for the elasticache clients. | +| [redis\_host](#output\_redis\_host) | Hostname of the redis host in the replication group. | +| [security\_group\_id](#output\_security\_group\_id) | Security group id for the elasticache. | +
vpc_id = string
private_subnets = list(string)
})