Skip to content

rso_postgres_database (Resource)

An additional database inside an rso_postgres_cluster. The cluster already comes with a database app owned by the role app; this adds more.

owner and reclaim_policy change in place. Destroying the resource removes the database from the platform's management; PostgreSQL drops it and its data only when reclaim_policy is delete. With retain (the default) the data stays in the cluster, and creating a database of the same name again takes it back over.

~> Requires a platform release with updatePostgresDatabase and deletePostgresDatabase.

Example Usage

resource "rso_postgres_database" "reports" {
  cluster = rso_postgres_cluster.db.name
  name    = "reports"
}

Schema

Required

  • cluster (String) Name of the rso_postgres_cluster the database lives in.
  • name (String) Database name, unique within the tenant (not only within the cluster).

Optional

  • owner (String) Existing PostgreSQL role that owns the database. Default app, the role every cluster has.
  • reclaim_policy (String) What happens to the data when the database is destroyed: retain (default) keeps it in the cluster, delete drops it.

Read-Only

  • id (String) <cluster>/<name>.

Import

Import is supported using the following syntax:

# Import an existing database as <cluster>/<name>.
terraform import rso_postgres_database.reports db/reports