From ea71913c4471f9771a001589901367f60f54e2f0 Mon Sep 17 00:00:00 2001 From: John Giannelos Date: Fri, 13 Oct 2017 15:45:12 +0200 Subject: [PATCH] Add generic memcache instance for remo --- remo.tf | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/remo.tf b/remo.tf index e543dab..5a4b1cd 100644 --- a/remo.tf +++ b/remo.tf @@ -23,3 +23,44 @@ module "remo-production" { elasticache_sg_description = "remo elasticache SG" iam-assume-role-policy = "${data.aws_iam_policy_document.containers-assume-role-policy.json}" } + +# Generic remo memcache instance +resource "aws_security_group" "remo-memcache-sg" { + name = "generic-remo-memcache-sg" + description = "Generic remo memcache SG" + vpc_id = "${aws_vpc.apps-production-vpc.id}" +} + +resource "aws_security_group_rule" "remo-memcache-sg-allowmemcachefromslaves" { + type = "ingress" + from_port = 11211 + to_port = 11211 + protocol = "tcp" + source_security_group_id = "${module.mesos-cluster-production.mesos-cluster-slave-sg-id}" + security_group_id = "${aws_security_group.remo-memcache-sg.id}" +} + +resource "aws_security_group_rule" "remo-memcache-sg-allowegress" { + type = "egress" + from_port = 0 + to_port = 0 + protocol = "-1" + source_security_group_id = "${module.mesos-cluster-production.mesos-cluster-slave-sg-id}" + security_group_id = "${aws_security_group.remo-memcache-sg.id}" +} + +resource "aws_elasticache_cluster" "remo-memcache-ec" { + cluster_id = "remo-generic" + engine = "memcached" + node_type = "cache.t2.micro" + port = 11211 + num_cache_nodes = 1 + subnet_group_name = "${aws_elasticache_subnet_group.elasticache-production-subnet-group.name}" + security_group_ids = ["${aws_security_group.remo-memcache-sg.id}"] + tags { + Name = "remo-generic-memcache" + app = "memcache" + env = "production" + project = "remo" + } +}