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.
1
// In a module as part of a deployment set:
2
...
3
"externals": {
4
"my-db": {
5
"type": "postgres",
6
"params": {
7
"extensions": {
8
"uuid-ossp": {
9
"schema": "uuid_schema",
10
"version": "1.1"
11
}
12
}
13
}
14
}
15
}
16
...
Copied!

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:
1
postgresql://${externals.my-db.username}:${externals.my-db.password}@${externals.my-db.host}:${externals.my-db.port}/${externals.my-db.name}
Copied!
Last modified 7mo ago