Skip to content

live-eo/terraform-postgres-db

Repository files navigation

terraform-postgres-db

Description

Postgres-db module creates all the necessary configurations for the provided database cluster. Depending on the input variables, this module will create multiple databases, users, schemas. For the users' privileges, each user can be granted different roles based on the input. There are only three roles to be granted for each database: Admin, Read_Write, and Read_Only.


Setup/Installation

Create a virtual environment and install requirements.

sudo apt install snapd
sudo snap install go --classic
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
pre-commit install

Requirements

  • pip

Usage

  • terraform-postgres-db needs as an input the list of databases to be initially created within the RDS cluster specified by the provider_config input, along with schemas and users. Within the schemas input you can specify which database the schema should be created in. Also, within the users input you can specify the privileges each user needs to be granted on each database created.

Requirements

Name Version
postgresql 1.22.0

Providers

Name Version
postgresql 1.22.0

Modules

No modules.

Resources

Name Type
postgresql_database.simple resource
postgresql_extension.assets_postgis resource
postgresql_grant.revoke_database resource
postgresql_schema.schemas resource

Inputs

Name Description Type Default Required
databases List of databases that will be created. list(string) n/a yes
provider_config n/a map(any)
{
"connect_timeout": "22",
"database": "postgres",
"host": "postgres",
"port": "5432",
"sslmode": "disable",
"superuser": false,
"username": "postgres"
}
no
provider_pass n/a string n/a yes
schemas Map of schemas to be created in a specific database. map(object({ database = string })) {} no

Outputs

No outputs.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages