-
Notifications
You must be signed in to change notification settings - Fork 2
/
db-fcrepo.tf
67 lines (53 loc) · 1.73 KB
/
db-fcrepo.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_fcrepo_password" {
source = "./modules/password"
}
module "db_fcrepo" {
source = "terraform-aws-modules/rds/aws"
version = "~> 5.0"
identifier = "${local.namespace}-fcrepo-db"
engine = "postgres"
engine_version = var.postgres_version
family = "postgres14"
major_engine_version = "14"
instance_class = "db.t3.micro"
allocated_storage = 40
db_name = "fcrepo"
username = var.db_fcrepo_username
password = module.db_fcrepo_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_fcrepo_host" {
name = "/${local.namespace}-fcrepo-db/host"
value = module.db_fcrepo.db_instance_address
type = "String"
overwrite = true
}
resource "aws_ssm_parameter" "db_fcrepo_port" {
name = "/${local.namespace}-fcrepo-db/port"
value = module.db_fcrepo.db_instance_port
type = "String"
overwrite = true
}
resource "aws_ssm_parameter" "db_fcrepo_admin_user" {
name = "/${local.namespace}-fcrepo-db/admin_user"
value = module.db_fcrepo.db_instance_username
type = "SecureString"
overwrite = true
}
resource "aws_ssm_parameter" "db_fcrepo_admin_password" {
name = "/${local.namespace}-fcrepo-db/admin_password"
value = module.db_fcrepo.db_instance_password
type = "SecureString"
overwrite = true
}