Skip to content

Commit 399c7f4

Browse files
committed
feat: Update Memcached cluster example
1 parent 6f3ee51 commit 399c7f4

File tree

14 files changed

+128
-133
lines changed

14 files changed

+128
-133
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ No modules.
6969
| <a name="input_create_cluster"></a> [create\_cluster](#input\_create\_cluster) | Determines whether an ElastiCache cluster will be created or not | `bool` | `true` | no |
7070
| <a name="input_create_parameter_group"></a> [create\_parameter\_group](#input\_create\_parameter\_group) | Determines whether the ElastiCache parameter group will be created or not | `bool` | `false` | no |
7171
| <a name="input_create_replication_group"></a> [create\_replication\_group](#input\_create\_replication\_group) | Determines whether an ElastiCache replication group will be created or not | `bool` | `false` | no |
72-
| <a name="input_create_subnet_group"></a> [create\_subnet\_group](#input\_create\_subnet\_group) | Determines whether the Elasticache subnet group will be created or not | `bool` | `false` | no |
72+
| <a name="input_create_subnet_group"></a> [create\_subnet\_group](#input\_create\_subnet\_group) | Determines whether the Elasticache subnet group will be created or not | `bool` | `true` | no |
7373
| <a name="input_data_tiering_enabled"></a> [data\_tiering\_enabled](#input\_data\_tiering\_enabled) | 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 | `bool` | `null` | no |
7474
| <a name="input_description"></a> [description](#input\_description) | User-created description for the replication group | `string` | `null` | no |
7575
| <a name="input_engine"></a> [engine](#input\_engine) | Name of the cache engine to be used for this cache cluster. Valid values are `memcached` or `redis` | `string` | `"redis"` | no |

examples/complete-memcached-cluster/README.md

Lines changed: 0 additions & 53 deletions
This file was deleted.

examples/complete-memcached-cluster/cluster.tf

Lines changed: 0 additions & 44 deletions
This file was deleted.

examples/complete-memcached-cluster/main.tf

Lines changed: 0 additions & 15 deletions
This file was deleted.

examples/complete-memcached-cluster/outputs.tf

Whitespace-only changes.

examples/complete/outputs.tf

Whitespace-only changes.

examples/complete/variables.tf

Whitespace-only changes.

examples/complete/versions.tf

Lines changed: 0 additions & 10 deletions
This file was deleted.

examples/complete/README.md renamed to examples/memcached-cluster/README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
# Complete AWS ElastiCache Example
1+
# ElastiCache example for Memcached cluster
22

3-
Configuration in this directory creates:
4-
5-
- <XXX>
3+
Configuration in this directory creates set of ElastiCaChe resources including cluster, subnet group and parameter group.
64

75
## Usage
86

examples/complete/main.tf renamed to examples/memcached-cluster/main.tf

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ data "aws_availability_zones" "available" {}
66

77
locals {
88
region = "us-east-1"
9-
name = "elasticache-ex-${basename(path.cwd)}"
9+
name = "ex-${basename(path.cwd)}"
1010

1111
vpc_cidr = "10.0.0.0/16"
1212
azs = slice(data.aws_availability_zones.available.names, 0, 3)
@@ -19,17 +19,46 @@ locals {
1919
}
2020

2121
################################################################################
22-
# elasticache Module
22+
# ElastiCache Module
2323
################################################################################
2424

25-
module "elasticache" {
26-
source = "../.."
25+
module "elasticache_cluster" {
26+
source = "../../"
2727

28-
create = false
28+
cluster_id = local.name
29+
30+
engine = "memcached"
31+
engine_version = "1.6"
32+
node_type = "cache.t4g.small"
33+
num_cache_nodes = 2
34+
az_mode = "cross-az"
35+
36+
security_group_ids = []
37+
38+
# subnet group
39+
subnet_group_name = local.name
40+
subnet_group_description = "${title(local.name)} subnet group"
41+
subnet_ids = module.vpc.private_subnets
42+
43+
maintenance_window = "sun:05:00-sun:09:00"
44+
apply_immediately = true
45+
46+
# parameter group
47+
create_parameter_group = true
48+
parameter_group_name = local.name
49+
parameter_group_family = "memcached1.6"
50+
parameter_group_description = "${title(local.name)} parameter group"
51+
parameters = [
52+
{
53+
name = "idle_timeout"
54+
value = 60
55+
}
56+
]
2957

3058
tags = local.tags
3159
}
3260

61+
3362
module "elasticache_disabled" {
3463
source = "../.."
3564

0 commit comments

Comments
 (0)