-
Notifications
You must be signed in to change notification settings - Fork 0
/
backend.tf
56 lines (51 loc) · 1.96 KB
/
backend.tf
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
resource "aws_db_subnet_group" "cloudstate-rds-subgrp" {
name = "main"
subnet_ids = [module.vpc.private_subnets[0], module.vpc.private_subnets[1], module.vpc.private_subnets[2]]
tags = {
Name = "Subnet group for RDS instance"
}
}
# memcached elasticcache instance
resource "aws_elasticache_subnet_group" "cloudstate-ecache-subgrp" {
name = "cloudstate-ecache-subgrp"
subnet_ids = [module.vpc.private_subnets[0], module.vpc.private_subnets[1], module.vpc.private_subnets[2]]
}
resource "aws_db_instance" "cloudstate-rds" {
allocated_storage = 20
storage_type = "gp2"
engine = "mysql"
engine_version = "5.7.37"
identifier = "cloudstaterds"
instance_class = "db.t2.micro"
db_name = var.db_name
username = var.dbuser
password = var.dbpass
parameter_group_name = "default.mysql5.7"
multi_az = "false"
publicly_accessible = "false"
skip_final_snapshot = true
db_subnet_group_name = aws_db_subnet_group.cloudstate-rds-subgrp.name
vpc_security_group_ids = [aws_security_group.cloudstate-backend-sg.id]
}
resource "aws_elasticache_cluster" "cloudstate-ecache" {
cluster_id = "cloudstate-ecache"
engine = "memcached"
node_type = "cache.t2.micro"
num_cache_nodes = 1
parameter_group_name = "default.memcached1.6"
port = 11211
security_group_ids = [aws_security_group.cloudstate-backend-sg.id]
subnet_group_name = aws_elasticache_subnet_group.cloudstate-ecache-subgrp.name
}
resource "aws_mq_broker" "cloudstate-rmq" {
broker_name = "cloudstate-rmq"
engine_type = "ActiveMQ"
engine_version = "5.15.0"
host_instance_type = "mq.t2.micro"
security_groups = [aws_security_group.cloudstate-backend-sg.id]
subnet_ids = [module.vpc.private_subnets[0]]
user {
username = var.rmquser
password = var.rmqpass
}
}