forked from appychipDevOps/Strapi_Deployment_Automation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
aws_rds.tf
28 lines (24 loc) · 819 Bytes
/
aws_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
resource "aws_db_instance" "strapi" {
db_name = "strapiDB"
identifier = "strapi-db"
instance_class = "db.t3.micro"
allocated_storage = 5
engine = "postgres"
engine_version = "11.22"
username = var.db_username
password = var.db_password
vpc_security_group_ids = [aws_security_group.db_sg.id]
publicly_accessible = true
skip_final_snapshot = true
}
resource "null_resource" "rds_details" {
provisioner "local-exec" {
command = <<EOF
echo '{
"database_hostname": "${aws_db_instance.strapi.address}",
"database_name": "${aws_db_instance.strapi.db_name}",
"database_username": "${aws_db_instance.strapi.username}"
}' > ./output/rds-details.json
EOF
}
}