Skip to content

Commit 94664c4

Browse files
authored
Add elasticache redis examples (#3)
1 parent b1e4ce8 commit 94664c4

File tree

9 files changed

+219
-0
lines changed

9 files changed

+219
-0
lines changed
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
provider "aws" {
2+
region = "us-east-1"
3+
}
4+
5+
6+
###################################################
7+
# ElastiCache Redis Cluster
8+
###################################################
9+
10+
module "cluster" {
11+
source = "../../modules/elasticache-redis-cluster"
12+
# source = "tedilabs/db/aws//modules/elasticache-redis-cluster"
13+
# version = "~> 0.2.0"
14+
15+
name = "example-redis-full"
16+
description = "Managed by Terraform."
17+
18+
redis_version = "6.2"
19+
node_instance_type = "cache.t4g.micro"
20+
# node_size = 1
21+
sharding = {
22+
enabled = true
23+
shard_size = 3
24+
replicas = 2
25+
}
26+
27+
28+
## Network
29+
port = 6379
30+
vpc_id = null
31+
subnet_group = null
32+
preferred_availability_zones = []
33+
34+
default_security_group = {
35+
eanbled = true
36+
name = "example-redis-full-default-sg"
37+
description = "Managed by Terraform."
38+
39+
ingress_rules = [
40+
{
41+
cidr_blocks = ["0.0.0.0/0"]
42+
}
43+
]
44+
}
45+
security_groups = []
46+
47+
48+
## Parameters
49+
parameter_group = {
50+
enabled = true
51+
name = "example-redis-full-parameter-group"
52+
description = "Managed by Terraform."
53+
parameters = {
54+
"lazyfree-lazy-eviction" = "yes"
55+
"lazyfree-lazy-expire" = "yes"
56+
"lazyfree-lazy-server-del" = "yes"
57+
"rename-commands" = "KEYS BLOCKED"
58+
}
59+
}
60+
custom_parameter_group = null
61+
62+
63+
## Auth
64+
password = sensitive("helloworld!#!!1234")
65+
user_groups = []
66+
67+
68+
## Encryption
69+
encryption_at_rest = {
70+
enabled = true
71+
kms_key = null
72+
}
73+
encryption_in_transit = {
74+
enabled = true
75+
}
76+
77+
78+
## Backup
79+
backup_enabled = true
80+
backup_window = "16:00-17:00"
81+
backup_retention = 1
82+
backup_final_snapshot_name = "example-redis-full-final"
83+
84+
85+
## Source
86+
source_backup_name = null
87+
source_rdb_s3_arns = null
88+
89+
90+
## Maintenance
91+
maintenance_window = "fri:18:00-fri:20:00"
92+
auto_upgrade_minor_version_enabled = true
93+
notification_sns_topic = null
94+
95+
96+
## Logging
97+
logging_slow_log = {
98+
enabled = false
99+
format = "JSON"
100+
101+
destination_type = "CLOUDWATCH_LOGS"
102+
destination = null
103+
}
104+
logging_engine_log = {
105+
enabled = false
106+
format = "JSON"
107+
108+
destination_type = "CLOUDWATCH_LOGS"
109+
destination = null
110+
}
111+
112+
113+
## Attributes
114+
multi_az_enabled = true
115+
auto_failover_enabled = true
116+
apply_immediately = true
117+
118+
timeouts = {
119+
create = "60m"
120+
update = "40m"
121+
delete = "40m"
122+
}
123+
124+
tags = {
125+
"project" = "terraform-aws-db-examples"
126+
}
127+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
output "cluster" {
2+
value = module.cluster
3+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
terraform {
2+
required_version = "~> 1.3"
3+
4+
required_providers {
5+
aws = {
6+
source = "hashicorp/aws"
7+
version = "~> 4.0"
8+
}
9+
}
10+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
provider "aws" {
2+
region = "us-east-1"
3+
}
4+
5+
6+
###################################################
7+
# ElastiCache Redis Cluster
8+
###################################################
9+
10+
module "cluster" {
11+
source = "../../modules/elasticache-redis-cluster"
12+
# source = "tedilabs/db/aws//modules/elasticache-redis-cluster"
13+
# version = "~> 0.2.0"
14+
15+
name = "example-redis-multi-az"
16+
description = "Managed by Terraform."
17+
18+
redis_version = "6.2"
19+
node_instance_type = "cache.t4g.micro"
20+
node_size = 2
21+
22+
multi_az_enabled = true
23+
auto_failover_enabled = true
24+
25+
tags = {
26+
"project" = "terraform-aws-db-examples"
27+
}
28+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
output "cluster" {
2+
value = module.cluster
3+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
terraform {
2+
required_version = "~> 1.3"
3+
4+
required_providers {
5+
aws = {
6+
source = "hashicorp/aws"
7+
version = "~> 4.0"
8+
}
9+
}
10+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
provider "aws" {
2+
region = "us-east-1"
3+
}
4+
5+
6+
###################################################
7+
# ElastiCache Redis Cluster
8+
###################################################
9+
10+
module "cluster" {
11+
source = "../../modules/elasticache-redis-cluster"
12+
# source = "tedilabs/db/aws//modules/elasticache-redis-cluster"
13+
# version = "~> 0.2.0"
14+
15+
name = "example-redis-single"
16+
description = "Managed by Terraform."
17+
18+
redis_version = "6.2"
19+
node_instance_type = "cache.t4g.micro"
20+
node_size = 1
21+
22+
tags = {
23+
"project" = "terraform-aws-db-examples"
24+
}
25+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
output "cluster" {
2+
value = module.cluster
3+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
terraform {
2+
required_version = "~> 1.3"
3+
4+
required_providers {
5+
aws = {
6+
source = "hashicorp/aws"
7+
version = "~> 4.0"
8+
}
9+
}
10+
}

0 commit comments

Comments
 (0)