Skip to content

rds-postgres example

Combines modules/vpc and modules/rds-postgres: a VPC with two private subnets and a single-instance, encrypted PostgreSQL database whose password lives in Secrets Manager. Only the app security group can connect.

Creates a billable RDS instance; do not apply it in a real account without reviewing the cost.

Requirements

Name Version
terraform >= 1.6.0
aws >= 5.0

Providers

Name Version
aws >= 5.0

Modules

Name Source Version
database ../../modules/rds-postgres n/a
vpc ../../modules/vpc n/a

Resources

Name Type
aws_security_group.app resource

Inputs

Name Description Type Default Required
azs Exactly two availability zones in region to spread the subnets across. list(string)
[
"us-east-1a",
"us-east-1b"
]
no
region AWS region to deploy the example into. string "us-east-1" no

Outputs

Name Description
app_security_group_id Security group allowed to connect to the database.
endpoint Connection endpoint of the example database in address:port form.
master_user_secret_arn ARN of the Secrets Manager secret with the master user credentials.