This provisions a new PostgreSQL database in an existing PostgreSQL instance. The instance must be reachable from Humanitec IPs.

Property Description
Resource Type postgres
Account Type None



Name Type Description
host string The IP Address or hostname that the instance is available on.
port integer The port the instance is listening on.
name string [Optional] The name of the maintenance database to connect to. Defaults to postgres.
append_host_to_user boolean [Optional] Azure Databases for Postgres and MySQL require usernames to have @servername appended to them. Set this to true for the Driver to append this automatically. (See: Azure Database connection strings)
template_name string [Optional] If provided, the Driver will use this database name as a template. See CREATE DATABASE.


Name Type Description
dbcredentials object An object holding username and password properties for the PostgreSQL superuser.


Automatic population of database

PostgreSQL supports creating databases based on templates. (See CREATE DATABASE) This functionality can be used to effectively pre-populate a database as it is provisioned.

It is important to be familiar with the constraints of template databases in PostgreSQL. The documentation states:


To create a fresh PostgreSQL database in an instance available at

curl${HUMANITEC_ORG}/resources/defs \
  -X POST \
  -H "Authorization: Bearer ${HUMANITEC_TOKEN}" \
  -H "Content-Type: application/json" \
  --data-binary '
  "id": "dev-postgres",
  "name": "Dev PostgreSQL",
  "type": "postgres",
  "criteria": [
      "env_type": "development"
  "driver_type": "humanitec/postgres",
  "driver_inputs": {
    "values": {
      "host": "",
      "port": 5432,
      "name": "postgres"
    "secrets": {
      "dbcredentials": {
        "username": "postgres",
        "password": "53cr3t-P455w0rd"