Problem
After upgrading Terraform Enterprise to version v202209-2 or later, the application fails to start. The tfe-migrations container logs show a PostgreSQL syntax error related to PROCEDURE.
StandardError: An error has occurred, all later migrations canceled: PG::SyntaxError: ERROR: syntax error at or near "PROCEDURE" LINE 2: CREATE OR REPLACE PROCEDURE execute_transaction()
Prerequisites
- Terraform Enterprise version
v202209-2or later. - An external PostgreSQL database version
10.xor9.x.
Cause
Terraform Enterprise v202209-2 and newer versions are no longer compatible with PostgreSQL versions 10.x or 9.x. The startup migration fails because older PostgreSQL versions do not support the CREATE OR REPLACE PROCEDURE syntax used in the new database schema migrations.
Solution
To resolve this issue, you must upgrade the external PostgreSQL database instance used by Terraform Enterprise to a compatible version, such as PostgreSQL 11.x or higher.
Additional Information
For more details on this requirement, please refer to the Terraform Enterprise v202209-2 release notes.