planetscalepostgresbranch (Resource)

June 1, 2026 ยท View on GitHub

PostgresBranch Resource

Example Usage

resource "planetscale_postgres_branch" "my_postgresbranch" {
  organization  = "my-organization"
  database      = "ru00w3vqvfr9"

  name          = "my-branch"
  cluster_size  = "PS_10_AWS_ARM"
}

Schema

Required

  • database (String) Database name slug from list_databases. Example: app-db.
  • name (String) The name of the branch to create
  • organization (String) Organization name slug from list_organizations. Example: acme.

Optional

  • backup_id (String) If provided, restores the backup's schema and data to the new branch. Must have restore_production_branch_backup(s) or restore_backup(s) access to do this. Requires replacement if changed.
  • cluster_size (String) The size of the cluster. Available sizes can be found using the 'List cluster sizes' endpoint.
  • delete_descendants (Boolean) If true, recursively delete all descendant branches along with this branch
  • major_version (String) For PostgreSQL databases, the PostgreSQL major version to use for the branch. Defaults to the major version of the parent branch if it exists or the database's default branch major version. Ignored for branches restored from backups. Requires replacement if changed.
  • parent_branch (String) The name of the parent branch. Defaults to the database's default branch if not provided. Requires replacement if changed.
  • region (String) The region to create the branch in. If not provided, the branch will be created in the default region for its database. Requires replacement if changed.
  • restore_point (String) Restore from a point-in-time recovery timestamp (e.g. 2023-01-01T00:00:00Z). Available only for PostgreSQL databases. Requires replacement if changed.

Read-Only

  • actor (Attributes) (see below for nested schema)
  • html_url (String) Planetscale app URL for the branch
  • id (String) The ID of the branch
  • ready (Boolean) Whether or not the branch is ready to serve queries
  • region_data (Attributes) (see below for nested schema)
  • replicas (Number) The number of replicas for the branch
  • state (String) The current state of the branch
  • url (String) Planetscale API URL for the branch

Nested Schema for actor

Read-Only:

  • id (String) The ID of the actor

Nested Schema for region_data

Read-Only:

  • id (String) The ID of the region
  • mysql_supported (Boolean) Whether the region supports MySQL/Vitess databases
  • postgresql_supported (Boolean) Whether the region supports PostgreSQL databases

Import

Import is supported using the following syntax:

In Terraform v1.5.0 and later, the import block can be used with the id attribute, for example:

import {
  to = planetscale_postgres_branch.my_planetscale_postgres_branch
  id = jsonencode({
    database     = "..."
    id           = "..."
    organization = "..."
  })
}

The terraform import command can be used, for example:

terraform import planetscale_postgres_branch.my_planetscale_postgres_branch '{"database": "...", "id": "...", "organization": "..."}'