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({
from_port = number
to_port = number
protocol = string
cidr_blocks = list(string)
source_security_group_id = string
description = string
}))
| `[]` | 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 = {
cpu\_utilization\_too\_high = {
metric\_name = "EngineCPUUtilization"
statistic = "Average"
comparison\_operator = ">="
threshold = "85"
period = "300"
evaluation\_periods = "1"
alarm\_actions = [sns\_topic\_arn]
ok\_actions = [sns\_topic\_arn]
}
} | `any` | `{}` | no | -| [default\_alarm\_actions](#input\_default\_alarm\_actions) | The list of actions to execute when this alarm transitions into an ALARM state from any other state. Each action is specified as an Amazon Resource Name (ARN). | `list(string)` | `[]` | no | -| [default\_ok\_actions](#input\_default\_ok\_actions) | The list of actions to execute when this alarm transitions into an OK state from any other state. Each action is specified as an Amazon Resource Name (ARN). | `list(string)` | `[]` | no | -| [environment](#input\_environment) | Environment Variable used as a prefix | `string` | n/a | yes | -| [is\_enable\_default\_alarms](#input\_is\_enable\_default\_alarms) | if enable the default alarms | `bool` | `false` | no | -| [maintenance\_window](#input\_maintenance\_window) | Snapshot Retention Limit | `string` | `"mon:00:00-mon:03:00"` | no | -| [multi\_az\_enabled](#input\_multi\_az\_enabled) | Specifies whether to enable Multi-AZ Support for the replication group | `bool` | n/a | yes | -| [name](#input\_name) | Name of the ECS cluster to create | `string` | n/a | yes | -| [prefix](#input\_prefix) | The prefix name of customer to be displayed in AWS console and resource | `string` | n/a | yes | -| [redis\_cluster\_config](#input\_redis\_cluster\_config) | Configuration for redis cluster |
object({
port = number
instance_type = string
engine_version = string
node_count = number
})
| n/a | yes | -| [snapshot\_config](#input\_snapshot\_config) | (optional) Snapshot config to retain and create backup |
object({
snapshot_window = string
snapshot_retention_limit = number
})
|
{
"snapshot_retention_limit": 3,
"snapshot_window": "03:00-05:00"
}
| 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 |
object({
vpc_id = string
private_subnets = list(string)
})
| 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. |
list(object({
from_port = number
to_port = number
protocol = string
cidr_blocks = list(string)
source_security_group_id = string
description = string
}))
| `[]` | 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 = {
cpu\_utilization\_too\_high = {
metric\_name = "EngineCPUUtilization"
statistic = "Average"
comparison\_operator = ">="
threshold = "85"
period = "300"
evaluation\_periods = "1"
alarm\_actions = [sns\_topic\_arn]
ok\_actions = [sns\_topic\_arn]
}
} | `any` | `{}` | no | +| [default\_alarm\_actions](#input\_default\_alarm\_actions) | The list of actions to execute when this alarm transitions into an ALARM state from any other state. Each action is specified as an Amazon Resource Name (ARN). | `list(string)` | `[]` | no | +| [default\_ok\_actions](#input\_default\_ok\_actions) | The list of actions to execute when this alarm transitions into an OK state from any other state. Each action is specified as an Amazon Resource Name (ARN). | `list(string)` | `[]` | no | +| [environment](#input\_environment) | Environment Variable used as a prefix | `string` | n/a | yes | +| [is\_enable\_default\_alarms](#input\_is\_enable\_default\_alarms) | if enable the default alarms | `bool` | `false` | no | +| [maintenance\_window](#input\_maintenance\_window) | Snapshot Retention Limit | `string` | `"mon:00:00-mon:03:00"` | no | +| [multi\_az\_enabled](#input\_multi\_az\_enabled) | Specifies whether to enable Multi-AZ Support for the replication group | `bool` | n/a | yes | +| [name](#input\_name) | Name of the ECS cluster to create | `string` | n/a | yes | +| [prefix](#input\_prefix) | The prefix name of customer to be displayed in AWS console and resource | `string` | n/a | yes | +| [redis\_cluster\_config](#input\_redis\_cluster\_config) | Configuration for redis cluster |
object({
port = number
instance_type = string
engine_version = string
node_count = number
})
| n/a | yes | +| [snapshot\_config](#input\_snapshot\_config) | (optional) Snapshot config to retain and create backup |
object({
snapshot_window = string
snapshot_retention_limit = number
})
|
{
"snapshot_retention_limit": 3,
"snapshot_window": "03:00-05:00"
}
| 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 |
object({
vpc_id = string
private_subnets = list(string)
})
| 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. | + 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" 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 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" }