-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrds.tf
37 lines (31 loc) · 1.05 KB
/
rds.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
module "db" {
source = "terraform-aws-modules/rds/aws"
allocated_storage = 20
create_db_option_group = false
create_db_parameter_group = false
engine = "mysql"
engine_version = "8.0"
family = "mysql8.0"
identifier = "db-server"
instance_class = "db.t3.micro"
major_engine_version = "8.0"
manage_master_user_password = false
password = var.db_password
skip_final_snapshot = true
storage_type = "gp2"
username = var.db_username
vpc_security_group_ids = [module.db_sg.security_group_id]
}
module "db_sg" {
source = "terraform-aws-modules/security-group/aws"
description = "RDS instance security group"
egress_rules = ["all-all"]
ingress_with_source_security_group_id = [
{
rule = "mysql-tcp"
source_security_group_id = module.ec2_sg.security_group_id
}
]
name = "db-sg"
use_name_prefix = false
}