-
Notifications
You must be signed in to change notification settings - Fork 14
/
rds.tf
62 lines (46 loc) · 1.52 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# https://registry.terraform.io/modules/terraform-aws-modules/rds/aws/2.18.0
module "rds" {
source = "terraform-aws-modules/rds/aws"
version = "~> 2.18.0"
identifier = var.rds_identifier
availability_zone = var.rds_availability_zone
engine = var.rds_engine
engine_version = var.rds_engine_version
instance_class = var.rds_instance
allocated_storage = var.rds_storage
name = var.rds_name
username = var.rds_username
password = var.rds_password
port = var.rds_port
iam_database_authentication_enabled = true
vpc_security_group_ids = [aws_security_group.rds_security_group.id]
maintenance_window = var.rds_maintenance
backup_window = var.rds_backup
monitoring_interval = var.rds_monitoring_interval
monitoring_role_name = var.rds_monitoring_role_name
subnet_ids = module.vpc.database_subnets
family = var.rds_family
major_engine_version = var.rds_major_engine_version
final_snapshot_identifier = var.final_snapshot_identifier
deletion_protection = false
tags = local.tags
}
resource "aws_security_group" "rds_security_group" {
name = "rds-security-group"
description = "Security group for RDS"
vpc_id = module.vpc.vpc_id
ingress {
description = "RDS accessible from VPC"
from_port = var.rds_port
to_port = var.rds_port
protocol = "tcp"
cidr_blocks = [module.vpc.vpc_cidr_block]
}
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
tags = local.tags
}