» PostgreSQL Requirements for Terraform Enterprise

When Terraform Enterprise uses an external PostgreSQL database, the following must be present on it:

  • PostgreSQL version >= 9.4 and < 10.0
  • User with the ability to create/modify/read tables and indices on all schemas created
    • If it's not feasible to have a user with "CREATE EXTENSION", then create the extensions below before installation
  • The following PostgreSQL schemas must be installed into the database: rails, vault, registry

» Creating Schemas

To create schemas in PostgreSQL, the CREATE SCHEMA command is used. So to create the above required schemas, the following snippet must be run on the database:

CREATE SCHEMA rails;
CREATE SCHEMA vault;
CREATE SCHEMA registry;

When providing optional extra keyword parameters for the database connection, note an additional restriction on the sslmode parameter is that only the require, verify-full, verify-ca, and disable values are allowed.

» Creating Extensions

If the configured PostgreSQL user does not have permission to create PostgreSQL extensions (ie is not a superuser), then run the following SQL commands to create the proper extensions:

CREATE EXTENSION IF NOT EXISTS "hstore" WITH SCHEMA "rails";
CREATE EXTENSION IF NOT EXISTS "uuid-ossp" WITH SCHEMA "rails";
CREATE EXTENSION IF NOT EXISTS "citext" WITH SCHEMA "registry";