@@ -8,10 +8,259 @@ Terraform module which creates AWS ElastiCache resources.
8
8
9
9
See [ ` examples ` ] ( https://github.com/clowdhaus/terraform-aws-elasticache/tree/main/examples ) directory for working examples to reference:
10
10
11
+ ### Memcached Cluster
12
+
13
+ ``` hcl
14
+ module "elasticache" {
15
+ source = "clowdhaus/elasticache/aws"
16
+
17
+ cluster_id = "example-memcached"
18
+ create_cluster = true
19
+ create_replication_group = false
20
+
21
+ engine = "memcached"
22
+ engine_version = "1.6.17"
23
+ node_type = "cache.t4g.small"
24
+ num_cache_nodes = 2
25
+ az_mode = "cross-az"
26
+
27
+ maintenance_window = "sun:05:00-sun:09:00"
28
+ apply_immediately = true
29
+
30
+ # Security group
31
+ vpc_id = module.vpc.vpc_id
32
+ security_group_rules = {
33
+ ingress_vpc = {
34
+ # Default type is `ingress`
35
+ # Default port is based on the default engine port
36
+ description = "VPC traffic"
37
+ cidr_ipv4 = module.vpc.vpc_cidr_block
38
+ }
39
+ }
40
+
41
+ # Subnet Group
42
+ subnet_ids = module.vpc.private_subnets
43
+
44
+ # Parameter Group
45
+ create_parameter_group = true
46
+ parameter_group_family = "memcached1.6"
47
+ parameters = [
48
+ {
49
+ name = "idle_timeout"
50
+ value = 60
51
+ }
52
+ ]
53
+
54
+ tags = {
55
+ Terraform = "true"
56
+ Environment = "dev"
57
+ }
58
+ }
59
+ ```
60
+
61
+ ### Redis Cluster
62
+
63
+ ``` hcl
64
+ module "elasticache" {
65
+ source = "clowdhaus/elasticache/aws"
66
+
67
+ cluster_id = "example-redis"
68
+ create_cluster = true
69
+ create_replication_group = false
70
+
71
+ engine_version = "7.1"
72
+ node_type = "cache.t4g.small"
73
+
74
+ maintenance_window = "sun:05:00-sun:09:00"
75
+ apply_immediately = true
76
+
77
+ # Security group
78
+ vpc_id = module.vpc.vpc_id
79
+ security_group_rules = {
80
+ ingress_vpc = {
81
+ # Default type is `ingress`
82
+ # Default port is based on the default engine port
83
+ description = "VPC traffic"
84
+ cidr_ipv4 = module.vpc.vpc_cidr_block
85
+ }
86
+ }
87
+
88
+ # Subnet Group
89
+ subnet_ids = module.vpc.private_subnets
90
+
91
+ # Parameter Group
92
+ create_parameter_group = true
93
+ parameter_group_family = "redis7"
94
+ parameters = [
95
+ {
96
+ name = "latency-tracking"
97
+ value = "yes"
98
+ }
99
+ ]
100
+
101
+ tags = {
102
+ Terraform = "true"
103
+ Environment = "dev"
104
+ }
105
+ }
106
+ ```
107
+
108
+ ### Redis Cluster Mode
109
+
110
+ ``` hcl
111
+ module "elasticache" {
112
+ source = "clowdhaus/elasticache/aws"
113
+
114
+ replication_group_id = "example-redis-cluster"
115
+
116
+ # Cluster mode
117
+ cluster_mode_enabled = true
118
+ num_node_groups = 2
119
+ replicas_per_node_group = 3
120
+ automatic_failover_enabled = true
121
+ multi_az_enabled = true
122
+
123
+ maintenance_window = "sun:05:00-sun:09:00"
124
+ apply_immediately = true
125
+
126
+ # Security group
127
+ vpc_id = module.vpc.vpc_id
128
+ security_group_rules = {
129
+ ingress_vpc = {
130
+ # Default type is `ingress`
131
+ # Default port is based on the default engine port
132
+ description = "VPC traffic"
133
+ cidr_ipv4 = module.vpc.vpc_cidr_block
134
+ }
135
+ }
136
+
137
+ # Subnet Group
138
+ subnet_ids = module.vpc.private_subnets
139
+
140
+ # Parameter Group
141
+ create_parameter_group = true
142
+ parameter_group_family = "redis7"
143
+ parameters = [
144
+ {
145
+ name = "latency-tracking"
146
+ value = "yes"
147
+ }
148
+ ]
149
+
150
+ tags = {
151
+ Terraform = "true"
152
+ Environment = "dev"
153
+ }
154
+ }
155
+ ```
156
+
157
+ ### Redis Global Replication Group
158
+
159
+ ``` hcl
160
+ module "elasticache_primary" {
161
+ source = "clowdhaus/elasticache/aws"
162
+
163
+ replication_group_id = "example-redis-global-replication-group"
164
+ create_primary_global_replication_group = true
165
+
166
+ engine_version = "7.1"
167
+ node_type = "cache.r7g.large"
168
+
169
+ # Security group
170
+ vpc_id = module.vpc.vpc_id
171
+ security_group_rules = {
172
+ ingress_vpc = {
173
+ # Default type is `ingress`
174
+ # Default port is based on the default engine port
175
+ description = "VPC traffic"
176
+ cidr_ipv4 = module.vpc.vpc_cidr_block
177
+ }
178
+ }
179
+
180
+ # Subnet Group
181
+ subnet_ids = module.vpc.private_subnets
182
+
183
+ # Parameter Group
184
+ create_parameter_group = true
185
+ parameter_group_family = "redis7"
186
+
187
+ tags = {
188
+ Terraform = "true"
189
+ Environment = "dev"
190
+ }
191
+ }
192
+
193
+ module "elasticache_secondary" {
194
+ source = "clowdhaus/elasticache/aws"
195
+
196
+ providers = {
197
+ aws = aws.other_region
198
+ }
199
+
200
+ replication_group_id = "example-redis-global-replication-group"
201
+ global_replication_group_id = module.elasticache_primary.global_replication_group_id
202
+
203
+ # Security group
204
+ vpc_id = module.vpc.vpc_id
205
+ security_group_rules = {
206
+ ingress_vpc = {
207
+ # Default type is `ingress`
208
+ # Default port is based on the default engine port
209
+ description = "VPC traffic"
210
+ cidr_ipv4 = module.vpc.vpc_cidr_block
211
+ }
212
+ }
213
+
214
+ # Subnet Group
215
+ subnet_ids = module.vpc.private_subnets
216
+
217
+ tags = {
218
+ Terraform = "true"
219
+ Environment = "dev"
220
+ }
221
+ }
222
+ ```
223
+
224
+ ### Redis Replication Group
225
+
11
226
``` hcl
12
227
module "elasticache" {
13
228
source = "clowdhaus/elasticache/aws"
14
229
230
+ replication_group_id = "example-redis-replication-group"
231
+
232
+ engine_version = "7.1"
233
+ node_type = "cache.t4g.small"
234
+
235
+ transit_encryption_enabled = true
236
+ auth_token = "PickSomethingMoreSecure123!"
237
+ maintenance_window = "sun:05:00-sun:09:00"
238
+ apply_immediately = true
239
+
240
+ # Security group
241
+ vpc_id = module.vpc.vpc_id
242
+ security_group_rules = {
243
+ ingress_vpc = {
244
+ # Default type is `ingress`
245
+ # Default port is based on the default engine port
246
+ description = "VPC traffic"
247
+ cidr_ipv4 = module.vpc.vpc_cidr_block
248
+ }
249
+ }
250
+
251
+ # Subnet Group
252
+ subnet_ids = module.vpc.private_subnets
253
+
254
+ # Parameter Group
255
+ create_parameter_group = true
256
+ parameter_group_family = "redis7"
257
+ parameters = [
258
+ {
259
+ name = "latency-tracking"
260
+ value = "yes"
261
+ }
262
+ ]
263
+
15
264
tags = {
16
265
Terraform = "true"
17
266
Environment = "dev"
@@ -23,7 +272,11 @@ module "elasticache" {
23
272
24
273
Examples codified under the [ ` examples ` ] ( https://github.com/clowdhaus/terraform-aws-elasticache/tree/main/examples ) are intended to give users references for how to use the module(s) as well as testing/validating changes to the source code of the module. If contributing to the project, please be sure to make any appropriate updates to the relevant examples to allow maintainers to test your changes and to keep the examples up to date for users. Thank you!
25
274
26
- - [ Complete] ( https://github.com/clowdhaus/terraform-aws-elasticache/tree/main/examples/complete )
275
+ - [ Memcached Cluster] ( https://github.com/clowdhaus/terraform-aws-elasticache/tree/main/examples/memcached-cluster )
276
+ - [ Redis Cluster] ( https://github.com/clowdhaus/terraform-aws-elasticache/tree/main/examples/redis-cluster )
277
+ - [ Redis Cluster Mode] ( https://github.com/clowdhaus/terraform-aws-elasticache/tree/main/examples/redis-cluster-mode )
278
+ - [ Redis Global Replication Group] ( https://github.com/clowdhaus/terraform-aws-elasticache/tree/main/examples/redis-global-replication-group )
279
+ - [ Redis Replication Group] ( https://github.com/clowdhaus/terraform-aws-elasticache/tree/main/examples/redis-replication-group )
27
280
28
281
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
29
282
## Requirements
0 commit comments