-
Notifications
You must be signed in to change notification settings - Fork 2
/
db-avalon.tf
67 lines (53 loc) · 1.73 KB
/
db-avalon.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
63
64
65
66
module "db_avalon_password" {
source = "./modules/password"
}
module "db_avalon" {
source = "terraform-aws-modules/rds/aws"
version = "~> 5.0"
identifier = "${local.namespace}-avalon-db"
engine = "postgres"
engine_version = var.postgres_version
family = "postgres14"
major_engine_version = "14"
instance_class = "db.t3.micro"
allocated_storage = 20
db_name = "avalon"
username = var.db_avalon_username
password = module.db_avalon_password.result
port = 5432
option_group_name = "default:postgres-14"
maintenance_window = "Mon:00:00-Mon:03:00"
backup_window = "03:00-06:00"
backup_retention_period = 35
copy_tags_to_snapshot = true
vpc_security_group_ids = [aws_security_group.db.id]
create_db_subnet_group = true
subnet_ids = module.vpc.private_subnets
availability_zone = var.availability_zone
tags = local.common_tags
apply_immediately = true
}
resource "aws_ssm_parameter" "db_avalon_host" {
name = "/${local.namespace}-avalon-db/host"
value = module.db_avalon.db_instance_address
type = "String"
overwrite = true
}
resource "aws_ssm_parameter" "db_avalon_port" {
name = "/${local.namespace}-avalon-db/port"
value = module.db_avalon.db_instance_port
type = "String"
overwrite = true
}
resource "aws_ssm_parameter" "db_avalon_admin_user" {
name = "/${local.namespace}-avalon-db/admin_user"
value = module.db_avalon.db_instance_username
type = "SecureString"
overwrite = true
}
resource "aws_ssm_parameter" "db_avalon_admin_password" {
name = "/${local.namespace}-avalon-db/admin_password"
value = module.db_avalon.db_instance_password
type = "SecureString"
overwrite = true
}