Skip to content

Commit 61a4c4a

Browse files
author
Abdul Wahid
authored
Create parameter group description variable (#48)
* chore: documentation + examples update + minimum versions * fix: set parameter description independently to other description attributes
1 parent b878ddc commit 61a4c4a

File tree

13 files changed

+121
-33
lines changed

13 files changed

+121
-33
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ terraform.tfstate
66
*.tfstate*
77
terraform.tfvars
88
*.terraform.lock.hcl
9+
*vscode

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ repos:
1818
args: ['--allow-missing-credentials']
1919
- id: trailing-whitespace
2020
- repo: https://github.com/antonbabenko/pre-commit-terraform
21-
rev: v1.80.0
21+
rev: v1.82.0
2222
hooks:
2323
- id: terraform_fmt
2424
- id: terraform_docs

CHANGELOG.md

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,38 @@ All notable changes to this project will be documented in this file.
55
<a name="unreleased"></a>
66
## [Unreleased]
77

8-
- Use t4g instance sizes for examples + Update minimum redis version from 5.x to 6.x
9-
- Update terraform versions
8+
- chore(snapshot): Allow restore from a snapshot ([#46](https://github.com/umotif-public/terraform-aws-elasticache-redis/issues/46))
9+
- feat(subnet_group): Allow to pass an existing subnet group ([#44](https://github.com/umotif-public/terraform-aws-elasticache-redis/issues/44))
10+
11+
12+
<a name="3.4.0"></a>
13+
## [3.4.0] - 2023-07-14
14+
15+
- Remove provider max version constraints ([#47](https://github.com/umotif-public/terraform-aws-elasticache-redis/issues/47))
16+
17+
18+
<a name="3.3.0"></a>
19+
## [3.3.0] - 2023-04-20
20+
21+
- Add User Group ID support ([#39](https://github.com/umotif-public/terraform-aws-elasticache-redis/issues/39))
22+
- fix: Type of multi_az_enabled variable ([#36](https://github.com/umotif-public/terraform-aws-elasticache-redis/issues/36))
23+
- Allow to skip sg egress rules creation ([#40](https://github.com/umotif-public/terraform-aws-elasticache-redis/issues/40))
24+
25+
26+
<a name="3.1.4"></a>
27+
## [3.1.4] - 2022-07-13
28+
29+
30+
31+
<a name="3.2.0"></a>
32+
## [3.2.0] - 2022-07-13
33+
34+
- Documentation + Examples cleanup ([#33](https://github.com/umotif-public/terraform-aws-elasticache-redis/issues/33))
35+
36+
37+
<a name="3.1.3"></a>
38+
## [3.1.3] - 2022-07-12
39+
1040
- Add Data Tiering support ([#32](https://github.com/umotif-public/terraform-aws-elasticache-redis/issues/32))
1141

1242

@@ -125,7 +155,12 @@ All notable changes to this project will be documented in this file.
125155
- Initial commit of docs
126156

127157

128-
[Unreleased]: https://github.com/umotif-public/terraform-aws-elasticache-redis/compare/3.1.2...HEAD
158+
[Unreleased]: https://github.com/umotif-public/terraform-aws-elasticache-redis/compare/3.4.0...HEAD
159+
[3.4.0]: https://github.com/umotif-public/terraform-aws-elasticache-redis/compare/3.3.0...3.4.0
160+
[3.3.0]: https://github.com/umotif-public/terraform-aws-elasticache-redis/compare/3.1.4...3.3.0
161+
[3.1.4]: https://github.com/umotif-public/terraform-aws-elasticache-redis/compare/3.2.0...3.1.4
162+
[3.2.0]: https://github.com/umotif-public/terraform-aws-elasticache-redis/compare/3.1.3...3.2.0
163+
[3.1.3]: https://github.com/umotif-public/terraform-aws-elasticache-redis/compare/3.1.2...3.1.3
129164
[3.1.2]: https://github.com/umotif-public/terraform-aws-elasticache-redis/compare/3.1.1...3.1.2
130165
[3.1.1]: https://github.com/umotif-public/terraform-aws-elasticache-redis/compare/3.1.0...3.1.1
131166
[3.1.0]: https://github.com/umotif-public/terraform-aws-elasticache-redis/compare/3.0.0...3.1.0

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ module "redis" {
2222
num_cache_clusters = 2
2323
node_type = "cache.t4g.small"
2424
25-
engine_version = "6.x"
25+
engine_version = "7.0"
2626
port = 6379
2727
maintenance_window = "mon:03:00-mon:04:00"
2828
snapshot_window = "04:00-06:00"
@@ -35,7 +35,7 @@ module "redis" {
3535
auth_token = "1234567890asdfghjkl"
3636
3737
apply_immediately = true
38-
family = "redis6.x"
38+
family = "redis7"
3939
description = "Test elasticache redis."
4040
4141
subnet_ids = module.vpc.private_subnets
@@ -81,14 +81,14 @@ Module managed by [uMotif](https://github.com/umotif-public/)
8181
| Name | Version |
8282
|------|---------|
8383
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0.11 |
84-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.8.0 |
84+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.12.0 |
8585
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 3.3.2 |
8686

8787
## Providers
8888

8989
| Name | Version |
9090
|------|---------|
91-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.8.0 |
91+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.12.0 |
9292
| <a name="provider_random"></a> [random](#provider\_random) | >= 3.3.2 |
9393

9494
## Modules
@@ -139,6 +139,7 @@ No modules.
139139
| <a name="input_num_cache_clusters"></a> [num\_cache\_clusters](#input\_num\_cache\_clusters) | The number of cache clusters (primary and replicas) this replication group will have. If Multi-AZ is enabled, the value of this parameter must be at least 2. Updates will occur before other modifications. Conflicts with num\_node\_groups. | `number` | `1` | no |
140140
| <a name="input_num_node_groups"></a> [num\_node\_groups](#input\_num\_node\_groups) | Specify the number of node groups (shards) for this Redis replication group. Changing this number will trigger an online resizing operation before other settings modifications. | `number` | `0` | no |
141141
| <a name="input_parameter"></a> [parameter](#input\_parameter) | A list of Redis parameters to apply. Note that parameters may differ from one Redis family to another | <pre>list(object({<br> name = string<br> value = string<br> }))</pre> | `[]` | no |
142+
| <a name="input_parameter_group_description"></a> [parameter\_group\_description](#input\_parameter\_group\_description) | The description of the ElastiCache parameter group | `string` | `null` | no |
142143
| <a name="input_port"></a> [port](#input\_port) | The port number on which each of the cache nodes will accept connections. | `number` | `6379` | no |
143144
| <a name="input_preferred_cache_cluster_azs"></a> [preferred\_cache\_cluster\_azs](#input\_preferred\_cache\_cluster\_azs) | A list of EC2 availability zones in which the replication group's cache clusters will be created. The order of the availability zones in the list is not important. | `list(string)` | `null` | no |
144145
| <a name="input_replicas_per_node_group"></a> [replicas\_per\_node\_group](#input\_replicas\_per\_node\_group) | Specify the number of replica nodes in each node group. Valid values are 0 to 5. Changing this number will trigger an online resizing operation before other settings modifications. | `number` | `0` | no |

examples/redis-basic/main.tf

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,11 @@ module "redis" {
3333
num_cache_clusters = 2
3434
node_type = "cache.t4g.small"
3535

36-
engine_version = "6.x"
37-
port = 6379
38-
maintenance_window = "mon:03:00-mon:04:00"
39-
snapshot_window = "04:00-06:00"
40-
snapshot_retention_limit = 7
41-
final_snapshot_identifier = "redis-final-snapshot-name"
36+
engine_version = "7.0"
37+
port = 6379
38+
maintenance_window = "mon:03:00-mon:04:00"
39+
snapshot_window = "04:00-06:00"
40+
snapshot_retention_limit = 7
4241

4342
automatic_failover_enabled = true
4443
multi_az_enabled = true
@@ -48,7 +47,7 @@ module "redis" {
4847
auth_token = "1234567890asdfghjkl"
4948

5049
apply_immediately = true
51-
family = "redis6.x"
50+
family = "redis7"
5251
description = "Test elasticache redis."
5352

5453
subnet_ids = data.aws_subnets.all.ids
@@ -75,6 +74,7 @@ module "redis" {
7574
]
7675

7776
tags = {
78-
Project = "Test"
77+
Project = "Github"
78+
Environment = "test"
7979
}
8080
}

examples/redis-basic/versions.tf

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@ terraform {
22
required_version = ">= 1.0.11"
33

44
required_providers {
5-
aws = "~> 5.1"
6-
random = "~> 3.3"
5+
aws = {
6+
source = "hashicorp/aws"
7+
version = "~> 5"
8+
}
9+
10+
random = {
11+
source = "hashicorp/random"
12+
version = "~> 3.3"
13+
}
714
}
815
}

examples/redis-clustered-mode/main.tf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ module "redis" {
3030
replicas_per_node_group = 1
3131
num_node_groups = 2
3232

33-
engine_version = "6.x"
33+
engine_version = "7.0"
3434
port = 6379
3535
maintenance_window = "mon:03:00-mon:04:00"
3636
snapshot_window = "04:00-06:00"
@@ -43,7 +43,7 @@ module "redis" {
4343
auth_token = "1234567890asdfghjkl"
4444

4545
apply_immediately = true
46-
family = "redis6.x"
46+
family = "redis7"
4747
description = "Test elasticache redis."
4848

4949
subnet_ids = data.aws_subnets.all.ids
@@ -59,6 +59,7 @@ module "redis" {
5959
]
6060

6161
tags = {
62-
Project = "Test"
62+
Project = "Github"
63+
Environment = "test"
6364
}
6465
}

examples/redis-clustered-mode/versions.tf

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@ terraform {
22
required_version = ">= 1.0.11"
33

44
required_providers {
5-
aws = "~> 5.1"
6-
random = "~> 3.3"
5+
aws = {
6+
source = "hashicorp/aws"
7+
version = "~> 5"
8+
}
9+
10+
random = {
11+
source = "hashicorp/random"
12+
version = "~> 3.3"
13+
}
714
}
815
}

examples/redis-replication-group/main.tf

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,16 @@ module "redis_main" {
4545

4646
name_prefix = "redis-example-main"
4747
num_cache_clusters = 2
48-
node_type = "cache.m5.large"
48+
node_type = "cache.m7g.large"
4949
auth_token = "1234567890asdfghjkl"
5050

5151
subnet_ids = data.aws_subnets.main.ids
5252
vpc_id = data.aws_vpc.main.id
53+
54+
tags = {
55+
Project = "Github"
56+
Environment = "test"
57+
}
5358
}
5459

5560
resource "aws_elasticache_global_replication_group" "this" {
@@ -62,7 +67,7 @@ module "redis_replica" {
6267

6368
name_prefix = "redis-example-replica"
6469
num_cache_clusters = 2
65-
node_type = "cache.m5.large"
70+
node_type = "cache.m7g.large"
6671
auth_token = "1234567890asdfghjkl"
6772

6873
subnet_ids = data.aws_subnets.replica.ids
@@ -71,4 +76,9 @@ module "redis_replica" {
7176
global_replication_group_id = aws_elasticache_global_replication_group.this.global_replication_group_id
7277

7378
providers = { aws = aws.replica }
79+
80+
tags = {
81+
Project = "Github"
82+
Environment = "test"
83+
}
7484
}

examples/redis-replication-group/versions.tf

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@ terraform {
22
required_version = ">= 1.0.11"
33

44
required_providers {
5-
aws = "~> 5.1"
6-
random = "~> 3.3"
5+
aws = {
6+
source = "hashicorp/aws"
7+
version = "~> 5"
8+
}
9+
10+
random = {
11+
source = "hashicorp/random"
12+
version = "~> 3.3"
13+
}
714
}
815
}

main.tf

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ resource "aws_elasticache_replication_group" "redis" {
4444
num_node_groups = var.cluster_mode_enabled ? var.num_node_groups : null
4545

4646
user_group_ids = var.user_group_ids
47+
4748
dynamic "log_delivery_configuration" {
4849
for_each = var.log_delivery_configuration
4950

@@ -74,7 +75,7 @@ resource "random_id" "redis_pg" {
7475
resource "aws_elasticache_parameter_group" "redis" {
7576
name = "${var.name_prefix}-redis-${random_id.redis_pg.hex}"
7677
family = var.family
77-
description = var.description
78+
description = var.parameter_group_description != null ? var.parameter_group_description : "Elasticache parameter group managed by Terraform"
7879

7980
dynamic "parameter" {
8081
for_each = var.num_node_groups > 0 ? concat([{ name = "cluster-enabled", value = "yes" }], var.parameter) : var.parameter
@@ -84,18 +85,22 @@ resource "aws_elasticache_parameter_group" "redis" {
8485
}
8586
}
8687

88+
# Ignore changes to the description since it will try to recreate the resource
8789
lifecycle {
88-
create_before_destroy = true
90+
ignore_changes = [
91+
description,
92+
]
8993
}
9094

9195
tags = var.tags
9296
}
9397

9498
resource "aws_elasticache_subnet_group" "redis" {
95-
count = var.subnet_group_name == null && length(var.subnet_ids) > 0 ? 1 : 0
99+
count = var.subnet_group_name == null && length(var.subnet_ids) > 0 ? 1 : 0
100+
96101
name = var.global_replication_group_id == null ? "${var.name_prefix}-redis-sg" : "${var.name_prefix}-redis-sg-replica"
97102
subnet_ids = var.subnet_ids
98-
description = var.description
103+
description = "Elasticache subnet group for ${var.description}"
99104

100105
tags = var.tags
101106
}

variables.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,15 @@ variable "data_tiering_enabled" {
239239
default = false
240240
description = "Enables data tiering. Data tiering is only supported for replication groups using the r6gd node type. This parameter must be set to true when using r6gd nodes."
241241
}
242+
242243
variable "user_group_ids" {
243244
type = list(string)
244245
default = null
245246
description = "User Group ID to associate with the replication group"
246247
}
248+
249+
variable "parameter_group_description" {
250+
type = string
251+
description = "The description of the ElastiCache parameter group"
252+
default = null
253+
}

versions.tf

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@ terraform {
22
required_version = ">= 1.0.11"
33

44
required_providers {
5-
aws = ">= 4.8.0"
6-
random = ">= 3.3.2"
5+
aws = {
6+
source = "hashicorp/aws"
7+
version = ">= 4.12.0"
8+
}
9+
10+
random = {
11+
source = "hashicorp/random"
12+
version = ">= 3.3.2"
13+
}
714
}
815
}

0 commit comments

Comments
 (0)