Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

Commit

Permalink
Add redis
Browse files Browse the repository at this point in the history
  • Loading branch information
wim-web committed Jan 24, 2021
1 parent b65a051 commit 722bcde
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
8 changes: 8 additions & 0 deletions terraform/domain.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,11 @@ resource "aws_route53_record" "rds" {
ttl = 300
records = [aws_db_instance.load-test.address]
}

resource "aws_route53_record" "this" {
zone_id = aws_route53_zone.private.zone_id
name = "redis.${aws_route53_zone.private.name}"
type = "CNAME"
ttl = 300
records = [aws_elasticache_cluster.load-test.cache_nodes.0.address]
}
20 changes: 20 additions & 0 deletions terraform/redis.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
variable "redis_version" {
type = string
default = "5.0.5"
}

resource "aws_elasticache_cluster" "load-test" {
cluster_id = "load-test"
engine_version = var.redis_version
engine = "redis"
node_type = "cache.m5.large"
num_cache_nodes = 1
port = 6379
subnet_group_name = aws_elasticache_subnet_group.load-test.name
security_group_ids = [aws_security_group.redis.id]
}

resource "aws_elasticache_subnet_group" "load-test" {
name = "load-test"
subnet_ids = [for s in aws_subnet.private : s.id]
}
12 changes: 12 additions & 0 deletions terraform/security_group.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,15 @@ resource "aws_security_group" "rds" {
security_groups = [aws_security_group.web.id]
}
}

resource "aws_security_group" "redis" {
name = "load-test-redis"
vpc_id = aws_vpc.this.id

ingress {
from_port = 6379
to_port = 6379
protocol = "tcp"
security_groups = [aws_security_group.web.id]
}
}

0 comments on commit 722bcde

Please sign in to comment.