Skip to content

Commit

Permalink
Merge pull request #1479 from alphagov/ianhowell-gds/chat-memcached
Browse files Browse the repository at this point in the history
Add serverless memcached for Chat service
  • Loading branch information
ianhowell-gds authored Oct 23, 2024
2 parents 6879d35 + c0850f6 commit 62ad336
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 62ad336

Please sign in to comment.