forked from Nova-reward/Nova-Rewards
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.tf
More file actions
34 lines (30 loc) · 1003 Bytes
/
Copy pathmain.tf
File metadata and controls
34 lines (30 loc) · 1003 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
resource "aws_elasticache_subnet_group" "this" {
name = "${var.app_name}-${var.environment}-redis"
subnet_ids = var.subnet_ids
}
resource "aws_security_group" "redis" {
name_prefix = "${var.app_name}-redis-"
vpc_id = var.vpc_id
ingress {
from_port = 6379
to_port = 6379
protocol = "tcp"
security_groups = [var.ec2_sg_id]
description = "Redis from EC2"
}
}
resource "aws_elasticache_replication_group" "this" {
replication_group_id = "${var.app_name}-${var.environment}"
description = "Nova Rewards Redis"
node_type = var.node_type
num_cache_clusters = var.environment == "prod" ? 2 : 1
port = 6379
subnet_group_name = aws_elasticache_subnet_group.this.name
security_group_ids = [aws_security_group.redis.id]
at_rest_encryption_enabled = true
transit_encryption_enabled = true
auth_token = var.auth_token
lifecycle {
ignore_changes = [auth_token]
}
}