Skip to content

Commit

Permalink
Add serverless memcached for Chat service
Browse files Browse the repository at this point in the history
  • Loading branch information
ianhowell-gds committed Oct 23, 2024
1 parent 54274d9 commit 71e8c02
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions terraform/deployments/chat/serverless_memcache.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
locals {
chat_memcached_name = "chat-memcached"
}

resource "aws_security_group" "chat_memcached" {
name = local.chat_memcached_name
vpc_id = data.tfe_outputs.vpc.nonsensitive_values.id
description = "${local.chat_memcached_name} memcached instance"
tags = {
Name = local.chat_memcached_name
}
}

resource "aws_elasticache_serverless_cache" "chat_memcached" {
name = local.chat_memcached_name
engine = "memcached"
major_engine_version = "1.6"
cache_usage_limits {
data_storage {
maximum = 10
unit = "GB"
}
ecpu_per_second {
maximum = 4000
}
}
subnet_ids = [local.elasticache_subnets]
security_group_ids = [aws_security_group.chat_memcached.id]
tags = {
Name = local.chat_memcached_name
}
}

resource "aws_route53_record" "chat_memcached" {
zone_id = local.internal_dns_zone_id
name = local.chat_memcached_name
type = "CNAME"
ttl = 300
records = [for k, v in aws_elasticache_serverless_cache.chat_memcached.endpoint : v.address]
}

0 comments on commit 71e8c02

Please sign in to comment.