Skip to main content
Updated October 19, 2026 Manages a database link: it connects an app to a running managed PostgreSQL database. The app gets its own database user and DATABASE_URL, DATABASE_HOST, DATABASE_PORT, DATABASE_USER, DATABASE_PASSWORD, DATABASE_NAME and DATABASE_CA_CERT, then redeploys. Connections go over Raff’s private network with TLS. Destroying the link removes the user and the variables and redeploys the app. link_database_id on raff_app_service does the same when the app is created. Use one of the two per database, not both.

Example

A second database needs its own prefix. This link sets ANALYTICS_URL, ANALYTICS_HOST and so on:

Argument reference

Changing any argument replaces the link. To give the app new database credentials without replacing it, run raff apps links rotate <link-id>. The app must not already have a variable with one of the link’s names, such as DATABASE_URL, or the link is refused.

Attribute reference (computed)

Import

The link ID is in raff apps links list <app-id>. After an import, database_id holds the database’s UUID. If your configuration names the database by its short ID, such as raff_database.main.id, list database_id in lifecycle { ignore_changes }, or Terraform plans to replace the link.
Last modified on October 19, 2026