1. Registry
  2. Packages
  3. Planetscale Provider
  4. API Docs
  5. PostgresReadOnlyReplica
Viewing docs for planetscale 1.9.0
published on Wednesday, Sep 2, 2026 by planetscale
Viewing docs for planetscale 1.9.0
published on Wednesday, Sep 2, 2026 by planetscale

    PostgresReadOnlyReplica Resource

    Create PostgresReadOnlyReplica Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new PostgresReadOnlyReplica(name: string, args: PostgresReadOnlyReplicaArgs, opts?: CustomResourceOptions);
    @overload
    def PostgresReadOnlyReplica(resource_name: str,
                                args: PostgresReadOnlyReplicaArgs,
                                opts: Optional[ResourceOptions] = None)
    
    @overload
    def PostgresReadOnlyReplica(resource_name: str,
                                opts: Optional[ResourceOptions] = None,
                                branch: Optional[str] = None,
                                database: Optional[str] = None,
                                organization: Optional[str] = None,
                                region: Optional[str] = None,
                                cluster_size: Optional[str] = None,
                                name: Optional[str] = None,
                                replicas: Optional[float] = None)
    func NewPostgresReadOnlyReplica(ctx *Context, name string, args PostgresReadOnlyReplicaArgs, opts ...ResourceOption) (*PostgresReadOnlyReplica, error)
    public PostgresReadOnlyReplica(string name, PostgresReadOnlyReplicaArgs args, CustomResourceOptions? opts = null)
    public PostgresReadOnlyReplica(String name, PostgresReadOnlyReplicaArgs args)
    public PostgresReadOnlyReplica(String name, PostgresReadOnlyReplicaArgs args, CustomResourceOptions options)
    
    type: planetscale:PostgresReadOnlyReplica
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    resource "planetscale_postgres_read_only_replica" "name" {
        # resource properties
    }

    Parameters

    name string
    The unique name of the resource.
    args PostgresReadOnlyReplicaArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args PostgresReadOnlyReplicaArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args PostgresReadOnlyReplicaArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args PostgresReadOnlyReplicaArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args PostgresReadOnlyReplicaArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var postgresReadOnlyReplicaResource = new Planetscale.PostgresReadOnlyReplica("postgresReadOnlyReplicaResource", new()
    {
        Branch = "string",
        Database = "string",
        Organization = "string",
        Region = "string",
        ClusterSize = "string",
        Name = "string",
        Replicas = 0.0,
    });
    
    example, err := planetscale.NewPostgresReadOnlyReplica(ctx, "postgresReadOnlyReplicaResource", &planetscale.PostgresReadOnlyReplicaArgs{
    	Branch:       pulumi.String("string"),
    	Database:     pulumi.String("string"),
    	Organization: pulumi.String("string"),
    	Region:       pulumi.String("string"),
    	ClusterSize:  pulumi.String("string"),
    	Name:         pulumi.String("string"),
    	Replicas:     pulumi.Float64(0),
    })
    
    resource "planetscale_postgres_read_only_replica" "postgresReadOnlyReplicaResource" {
      lifecycle {
        create_before_destroy = true
      }
      branch       = "string"
      database     = "string"
      organization = "string"
      region       = "string"
      cluster_size = "string"
      name         = "string"
      replicas     = 0
    }
    
    var postgresReadOnlyReplicaResource = new PostgresReadOnlyReplica("postgresReadOnlyReplicaResource", PostgresReadOnlyReplicaArgs.builder()
        .branch("string")
        .database("string")
        .organization("string")
        .region("string")
        .clusterSize("string")
        .name("string")
        .replicas(0.0)
        .build());
    
    postgres_read_only_replica_resource = planetscale.PostgresReadOnlyReplica("postgresReadOnlyReplicaResource",
        branch="string",
        database="string",
        organization="string",
        region="string",
        cluster_size="string",
        name="string",
        replicas=float(0))
    
    const postgresReadOnlyReplicaResource = new planetscale.PostgresReadOnlyReplica("postgresReadOnlyReplicaResource", {
        branch: "string",
        database: "string",
        organization: "string",
        region: "string",
        clusterSize: "string",
        name: "string",
        replicas: 0,
    });
    
    type: planetscale:PostgresReadOnlyReplica
    properties:
        branch: string
        clusterSize: string
        database: string
        name: string
        organization: string
        region: string
        replicas: 0
    

    PostgresReadOnlyReplica Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The PostgresReadOnlyReplica resource accepts the following input properties:

    Branch string
    Branch name from list_branches. Example: main.
    Database string
    Database name slug from list_databases. Example: app-db.
    Organization string
    Organization name slug from list_organizations. Example: acme.
    Region string
    The region slug for the read-only replica, e.g. us-east. The replica can run in a different region than the primary. Requires replacement if changed.
    ClusterSize string
    The cluster size SKU, e.g. PS_10_AWS_ARM. Defaults to the primary's cluster size.
    Name string
    The name of the read-only replica. Requires replacement if changed.
    Replicas double
    The number of instances serving reads. Defaults to 1.
    Branch string
    Branch name from list_branches. Example: main.
    Database string
    Database name slug from list_databases. Example: app-db.
    Organization string
    Organization name slug from list_organizations. Example: acme.
    Region string
    The region slug for the read-only replica, e.g. us-east. The replica can run in a different region than the primary. Requires replacement if changed.
    ClusterSize string
    The cluster size SKU, e.g. PS_10_AWS_ARM. Defaults to the primary's cluster size.
    Name string
    The name of the read-only replica. Requires replacement if changed.
    Replicas float64
    The number of instances serving reads. Defaults to 1.
    branch string
    Branch name from list_branches. Example: main.
    database string
    Database name slug from list_databases. Example: app-db.
    organization string
    Organization name slug from list_organizations. Example: acme.
    region string
    The region slug for the read-only replica, e.g. us-east. The replica can run in a different region than the primary. Requires replacement if changed.
    cluster_size string
    The cluster size SKU, e.g. PS_10_AWS_ARM. Defaults to the primary's cluster size.
    name string
    The name of the read-only replica. Requires replacement if changed.
    replicas number
    The number of instances serving reads. Defaults to 1.
    branch String
    Branch name from list_branches. Example: main.
    database String
    Database name slug from list_databases. Example: app-db.
    organization String
    Organization name slug from list_organizations. Example: acme.
    region String
    The region slug for the read-only replica, e.g. us-east. The replica can run in a different region than the primary. Requires replacement if changed.
    clusterSize String
    The cluster size SKU, e.g. PS_10_AWS_ARM. Defaults to the primary's cluster size.
    name String
    The name of the read-only replica. Requires replacement if changed.
    replicas Double
    The number of instances serving reads. Defaults to 1.
    branch string
    Branch name from list_branches. Example: main.
    database string
    Database name slug from list_databases. Example: app-db.
    organization string
    Organization name slug from list_organizations. Example: acme.
    region string
    The region slug for the read-only replica, e.g. us-east. The replica can run in a different region than the primary. Requires replacement if changed.
    clusterSize string
    The cluster size SKU, e.g. PS_10_AWS_ARM. Defaults to the primary's cluster size.
    name string
    The name of the read-only replica. Requires replacement if changed.
    replicas number
    The number of instances serving reads. Defaults to 1.
    branch str
    Branch name from list_branches. Example: main.
    database str
    Database name slug from list_databases. Example: app-db.
    organization str
    Organization name slug from list_organizations. Example: acme.
    region str
    The region slug for the read-only replica, e.g. us-east. The replica can run in a different region than the primary. Requires replacement if changed.
    cluster_size str
    The cluster size SKU, e.g. PS_10_AWS_ARM. Defaults to the primary's cluster size.
    name str
    The name of the read-only replica. Requires replacement if changed.
    replicas float
    The number of instances serving reads. Defaults to 1.
    branch String
    Branch name from list_branches. Example: main.
    database String
    Database name slug from list_databases. Example: app-db.
    organization String
    Organization name slug from list_organizations. Example: acme.
    region String
    The region slug for the read-only replica, e.g. us-east. The replica can run in a different region than the primary. Requires replacement if changed.
    clusterSize String
    The cluster size SKU, e.g. PS_10_AWS_ARM. Defaults to the primary's cluster size.
    name String
    The name of the read-only replica. Requires replacement if changed.
    replicas Number
    The number of instances serving reads. Defaults to 1.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the PostgresReadOnlyReplica resource produces the following output properties:

    AccessHostUrl string
    The database connection host for the read-only replica
    Id string
    The provider-assigned unique ID for this managed resource.
    PrivateAccessHostUrl string
    The private database connection host for the read-only replica
    PrivateConnectionServiceName string
    The service name to set up private connectivity for the read-only replica
    AccessHostUrl string
    The database connection host for the read-only replica
    Id string
    The provider-assigned unique ID for this managed resource.
    PrivateAccessHostUrl string
    The private database connection host for the read-only replica
    PrivateConnectionServiceName string
    The service name to set up private connectivity for the read-only replica
    access_host_url string
    The database connection host for the read-only replica
    id string
    The provider-assigned unique ID for this managed resource.
    private_access_host_url string
    The private database connection host for the read-only replica
    private_connection_service_name string
    The service name to set up private connectivity for the read-only replica
    accessHostUrl String
    The database connection host for the read-only replica
    id String
    The provider-assigned unique ID for this managed resource.
    privateAccessHostUrl String
    The private database connection host for the read-only replica
    privateConnectionServiceName String
    The service name to set up private connectivity for the read-only replica
    accessHostUrl string
    The database connection host for the read-only replica
    id string
    The provider-assigned unique ID for this managed resource.
    privateAccessHostUrl string
    The private database connection host for the read-only replica
    privateConnectionServiceName string
    The service name to set up private connectivity for the read-only replica
    access_host_url str
    The database connection host for the read-only replica
    id str
    The provider-assigned unique ID for this managed resource.
    private_access_host_url str
    The private database connection host for the read-only replica
    private_connection_service_name str
    The service name to set up private connectivity for the read-only replica
    accessHostUrl String
    The database connection host for the read-only replica
    id String
    The provider-assigned unique ID for this managed resource.
    privateAccessHostUrl String
    The private database connection host for the read-only replica
    privateConnectionServiceName String
    The service name to set up private connectivity for the read-only replica

    Look up Existing PostgresReadOnlyReplica Resource

    Get an existing PostgresReadOnlyReplica resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: PostgresReadOnlyReplicaState, opts?: CustomResourceOptions): PostgresReadOnlyReplica
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            access_host_url: Optional[str] = None,
            branch: Optional[str] = None,
            cluster_size: Optional[str] = None,
            database: Optional[str] = None,
            name: Optional[str] = None,
            organization: Optional[str] = None,
            private_access_host_url: Optional[str] = None,
            private_connection_service_name: Optional[str] = None,
            region: Optional[str] = None,
            replicas: Optional[float] = None) -> PostgresReadOnlyReplica
    func GetPostgresReadOnlyReplica(ctx *Context, name string, id IDInput, state *PostgresReadOnlyReplicaState, opts ...ResourceOption) (*PostgresReadOnlyReplica, error)
    public static PostgresReadOnlyReplica Get(string name, Input<string> id, PostgresReadOnlyReplicaState? state, CustomResourceOptions? opts = null)
    public static PostgresReadOnlyReplica get(String name, Output<String> id, PostgresReadOnlyReplicaState state, CustomResourceOptions options)
    resources:  _:    type: planetscale:PostgresReadOnlyReplica    get:      id: ${id}
    import {
      to = planetscale_postgres_read_only_replica.example
      id = "${id}"
    }
    
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    AccessHostUrl string
    The database connection host for the read-only replica
    Branch string
    Branch name from list_branches. Example: main.
    ClusterSize string
    The cluster size SKU, e.g. PS_10_AWS_ARM. Defaults to the primary's cluster size.
    Database string
    Database name slug from list_databases. Example: app-db.
    Name string
    The name of the read-only replica. Requires replacement if changed.
    Organization string
    Organization name slug from list_organizations. Example: acme.
    PrivateAccessHostUrl string
    The private database connection host for the read-only replica
    PrivateConnectionServiceName string
    The service name to set up private connectivity for the read-only replica
    Region string
    The region slug for the read-only replica, e.g. us-east. The replica can run in a different region than the primary. Requires replacement if changed.
    Replicas double
    The number of instances serving reads. Defaults to 1.
    AccessHostUrl string
    The database connection host for the read-only replica
    Branch string
    Branch name from list_branches. Example: main.
    ClusterSize string
    The cluster size SKU, e.g. PS_10_AWS_ARM. Defaults to the primary's cluster size.
    Database string
    Database name slug from list_databases. Example: app-db.
    Name string
    The name of the read-only replica. Requires replacement if changed.
    Organization string
    Organization name slug from list_organizations. Example: acme.
    PrivateAccessHostUrl string
    The private database connection host for the read-only replica
    PrivateConnectionServiceName string
    The service name to set up private connectivity for the read-only replica
    Region string
    The region slug for the read-only replica, e.g. us-east. The replica can run in a different region than the primary. Requires replacement if changed.
    Replicas float64
    The number of instances serving reads. Defaults to 1.
    access_host_url string
    The database connection host for the read-only replica
    branch string
    Branch name from list_branches. Example: main.
    cluster_size string
    The cluster size SKU, e.g. PS_10_AWS_ARM. Defaults to the primary's cluster size.
    database string
    Database name slug from list_databases. Example: app-db.
    name string
    The name of the read-only replica. Requires replacement if changed.
    organization string
    Organization name slug from list_organizations. Example: acme.
    private_access_host_url string
    The private database connection host for the read-only replica
    private_connection_service_name string
    The service name to set up private connectivity for the read-only replica
    region string
    The region slug for the read-only replica, e.g. us-east. The replica can run in a different region than the primary. Requires replacement if changed.
    replicas number
    The number of instances serving reads. Defaults to 1.
    accessHostUrl String
    The database connection host for the read-only replica
    branch String
    Branch name from list_branches. Example: main.
    clusterSize String
    The cluster size SKU, e.g. PS_10_AWS_ARM. Defaults to the primary's cluster size.
    database String
    Database name slug from list_databases. Example: app-db.
    name String
    The name of the read-only replica. Requires replacement if changed.
    organization String
    Organization name slug from list_organizations. Example: acme.
    privateAccessHostUrl String
    The private database connection host for the read-only replica
    privateConnectionServiceName String
    The service name to set up private connectivity for the read-only replica
    region String
    The region slug for the read-only replica, e.g. us-east. The replica can run in a different region than the primary. Requires replacement if changed.
    replicas Double
    The number of instances serving reads. Defaults to 1.
    accessHostUrl string
    The database connection host for the read-only replica
    branch string
    Branch name from list_branches. Example: main.
    clusterSize string
    The cluster size SKU, e.g. PS_10_AWS_ARM. Defaults to the primary's cluster size.
    database string
    Database name slug from list_databases. Example: app-db.
    name string
    The name of the read-only replica. Requires replacement if changed.
    organization string
    Organization name slug from list_organizations. Example: acme.
    privateAccessHostUrl string
    The private database connection host for the read-only replica
    privateConnectionServiceName string
    The service name to set up private connectivity for the read-only replica
    region string
    The region slug for the read-only replica, e.g. us-east. The replica can run in a different region than the primary. Requires replacement if changed.
    replicas number
    The number of instances serving reads. Defaults to 1.
    access_host_url str
    The database connection host for the read-only replica
    branch str
    Branch name from list_branches. Example: main.
    cluster_size str
    The cluster size SKU, e.g. PS_10_AWS_ARM. Defaults to the primary's cluster size.
    database str
    Database name slug from list_databases. Example: app-db.
    name str
    The name of the read-only replica. Requires replacement if changed.
    organization str
    Organization name slug from list_organizations. Example: acme.
    private_access_host_url str
    The private database connection host for the read-only replica
    private_connection_service_name str
    The service name to set up private connectivity for the read-only replica
    region str
    The region slug for the read-only replica, e.g. us-east. The replica can run in a different region than the primary. Requires replacement if changed.
    replicas float
    The number of instances serving reads. Defaults to 1.
    accessHostUrl String
    The database connection host for the read-only replica
    branch String
    Branch name from list_branches. Example: main.
    clusterSize String
    The cluster size SKU, e.g. PS_10_AWS_ARM. Defaults to the primary's cluster size.
    database String
    Database name slug from list_databases. Example: app-db.
    name String
    The name of the read-only replica. Requires replacement if changed.
    organization String
    Organization name slug from list_organizations. Example: acme.
    privateAccessHostUrl String
    The private database connection host for the read-only replica
    privateConnectionServiceName String
    The service name to set up private connectivity for the read-only replica
    region String
    The region slug for the read-only replica, e.g. us-east. The replica can run in a different region than the primary. Requires replacement if changed.
    replicas Number
    The number of instances serving reads. Defaults to 1.

    Import

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

    terraform

    import {

    to = planetscale_postgres_read_only_replica.my_planetscale_postgres_read_only_replica

    id = jsonencode({

    branch       = "..."
    
    database     = "..."
    
    name         = "..."
    
    organization = "..."
    

    })

    }

    The pulumi import command can be used, for example:

    $ pulumi import planetscale:index/postgresReadOnlyReplica:PostgresReadOnlyReplica my_planetscale_postgres_read_only_replica '{"branch": "...", "database": "...", "name": "...", "organization": "..."}'
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    planetscale planetscale/terraform-provider-planetscale
    License
    Notes
    This Pulumi package is based on the planetscale Terraform Provider.
    Viewing docs for planetscale 1.9.0
    published on Wednesday, Sep 2, 2026 by planetscale

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial