postgres

"postgres" Humanitec Resource Type

Used to provision a database in a PostgreSQL instance.

Inputs

Name

Description

extensions

An object with properties of required PostgreSQL extensions.

Each property represents an extension with the property name being the extension name. There are 2 optional sub properties of schema and version which are used to parameterise the CREATE EXTENSION statement.

Example:

Defining a dependency on a PostgreSQL database in a workload with the uuid-ossp extension installed.

// In a module as part of a deployment set:
...
"externals": {
"my-db": {
"type": "postgres",
"extensions": {
"uuid-ossp": {
"schema": "uuid_schema",
"version": "1.1"
}
}
}
}
...

Outputs

Name

Description

host

The IP Address or hostname that the instance is available on.

name

The name of the database that the workload should connect to.

password

The password for the user or role.

port

The port on the host that the instance is available on.

username

The user or role that the workload should use to connect to the database.

Example

For a PostgreSQL database added to a workload under the ID my-db, a connection string can be built as:

postgresql://${externals.my-db.username}:${externals.my-db.password}@${externals.my-db.host}:${externals.my-db.port}/${externals.my-db.name}

​