1. Packages
  2. Aptible Provider
  3. API Docs
  4. Replica
aptible 0.9.12 published on Monday, Apr 14, 2025 by aptible

aptible.Replica

Explore with Pulumi AI

aptible logo
aptible 0.9.12 published on Monday, Apr 14, 2025 by aptible

    # Aptible Database Replica Resource

    This resource is used to create and manage Database Replicas and Clusters running on Aptible Deploy.

    !> Changing the handle of a replica will destroy the existing replica and create a new one. It would then have to repopulate its contents from the primary database

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aptible from "@pulumi/aptible";
    
    const exampleDatabaseReplica = new aptible.Replica("exampleDatabaseReplica", {
        envId: 123,
        primaryDatabaseId: aptible_database.example_database.database_id,
        handle: "example_database_replica",
        diskSize: 30,
    });
    
    import pulumi
    import pulumi_aptible as aptible
    
    example_database_replica = aptible.Replica("exampleDatabaseReplica",
        env_id=123,
        primary_database_id=aptible_database["example_database"]["database_id"],
        handle="example_database_replica",
        disk_size=30)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/aptible/aptible"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := aptible.NewReplica(ctx, "exampleDatabaseReplica", &aptible.ReplicaArgs{
    			EnvId:             pulumi.Float64(123),
    			PrimaryDatabaseId: pulumi.Any(aptible_database.Example_database.Database_id),
    			Handle:            pulumi.String("example_database_replica"),
    			DiskSize:          pulumi.Float64(30),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aptible = Pulumi.Aptible;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleDatabaseReplica = new Aptible.Replica("exampleDatabaseReplica", new()
        {
            EnvId = 123,
            PrimaryDatabaseId = aptible_database.Example_database.Database_id,
            Handle = "example_database_replica",
            DiskSize = 30,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aptible.Replica;
    import com.pulumi.aptible.ReplicaArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var exampleDatabaseReplica = new Replica("exampleDatabaseReplica", ReplicaArgs.builder()
                .envId(123)
                .primaryDatabaseId(aptible_database.example_database().database_id())
                .handle("example_database_replica")
                .diskSize(30)
                .build());
    
        }
    }
    
    resources:
      exampleDatabaseReplica:
        type: aptible:Replica
        properties:
          envId: 123
          primaryDatabaseId: ${aptible_database.example_database.database_id}
          handle: example_database_replica
          diskSize: 30
    

    Create Replica Resource

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

    Constructor syntax

    new Replica(name: string, args: ReplicaArgs, opts?: CustomResourceOptions);
    @overload
    def Replica(resource_name: str,
                args: ReplicaArgs,
                opts: Optional[ResourceOptions] = None)
    
    @overload
    def Replica(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                env_id: Optional[float] = None,
                handle: Optional[str] = None,
                primary_database_id: Optional[float] = None,
                aptible_replica_id: Optional[str] = None,
                container_profile: Optional[str] = None,
                container_size: Optional[float] = None,
                disk_size: Optional[float] = None,
                enable_backups: Optional[bool] = None,
                iops: Optional[float] = None)
    func NewReplica(ctx *Context, name string, args ReplicaArgs, opts ...ResourceOption) (*Replica, error)
    public Replica(string name, ReplicaArgs args, CustomResourceOptions? opts = null)
    public Replica(String name, ReplicaArgs args)
    public Replica(String name, ReplicaArgs args, CustomResourceOptions options)
    
    type: aptible:Replica
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args ReplicaArgs
    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 ReplicaArgs
    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 ReplicaArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ReplicaArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ReplicaArgs
    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 replicaResource = new Aptible.Replica("replicaResource", new()
    {
        EnvId = 0,
        Handle = "string",
        PrimaryDatabaseId = 0,
        AptibleReplicaId = "string",
        ContainerProfile = "string",
        ContainerSize = 0,
        DiskSize = 0,
        EnableBackups = false,
        Iops = 0,
    });
    
    example, err := aptible.NewReplica(ctx, "replicaResource", &aptible.ReplicaArgs{
    	EnvId:             pulumi.Float64(0),
    	Handle:            pulumi.String("string"),
    	PrimaryDatabaseId: pulumi.Float64(0),
    	AptibleReplicaId:  pulumi.String("string"),
    	ContainerProfile:  pulumi.String("string"),
    	ContainerSize:     pulumi.Float64(0),
    	DiskSize:          pulumi.Float64(0),
    	EnableBackups:     pulumi.Bool(false),
    	Iops:              pulumi.Float64(0),
    })
    
    var replicaResource = new Replica("replicaResource", ReplicaArgs.builder()
        .envId(0)
        .handle("string")
        .primaryDatabaseId(0)
        .aptibleReplicaId("string")
        .containerProfile("string")
        .containerSize(0)
        .diskSize(0)
        .enableBackups(false)
        .iops(0)
        .build());
    
    replica_resource = aptible.Replica("replicaResource",
        env_id=0,
        handle="string",
        primary_database_id=0,
        aptible_replica_id="string",
        container_profile="string",
        container_size=0,
        disk_size=0,
        enable_backups=False,
        iops=0)
    
    const replicaResource = new aptible.Replica("replicaResource", {
        envId: 0,
        handle: "string",
        primaryDatabaseId: 0,
        aptibleReplicaId: "string",
        containerProfile: "string",
        containerSize: 0,
        diskSize: 0,
        enableBackups: false,
        iops: 0,
    });
    
    type: aptible:Replica
    properties:
        aptibleReplicaId: string
        containerProfile: string
        containerSize: 0
        diskSize: 0
        enableBackups: false
        envId: 0
        handle: string
        iops: 0
        primaryDatabaseId: 0
    

    Replica 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 Replica resource accepts the following input properties:

    EnvId double
    The ID of the environment you would like to deploy your Database in. The Environment does not have to be the same as the primary database, but the Environment does have to be in the same Stack as the primary Database. See main provider documentation for more on how to determine what you should use for env_id.
    Handle string
    The handle for the Database. This must be all lower case, and only contain letters, numbers, -, _, or .
    PrimaryDatabaseId double
    The ID of the Database the replica is being created from.
    AptibleReplicaId string
    ContainerProfile string
    Changes the CPU:RAM ratio of the Database container.
    ContainerSize double
    The size of container used for the Database, in MB of RAM.
    DiskSize double
    The disk size of the Database, in GB.
    EnableBackups bool
    Whether to automatically backup the database according to the retention policy.
    Iops double
    The disk Input/Output Operations Per Second
    EnvId float64
    The ID of the environment you would like to deploy your Database in. The Environment does not have to be the same as the primary database, but the Environment does have to be in the same Stack as the primary Database. See main provider documentation for more on how to determine what you should use for env_id.
    Handle string
    The handle for the Database. This must be all lower case, and only contain letters, numbers, -, _, or .
    PrimaryDatabaseId float64
    The ID of the Database the replica is being created from.
    AptibleReplicaId string
    ContainerProfile string
    Changes the CPU:RAM ratio of the Database container.
    ContainerSize float64
    The size of container used for the Database, in MB of RAM.
    DiskSize float64
    The disk size of the Database, in GB.
    EnableBackups bool
    Whether to automatically backup the database according to the retention policy.
    Iops float64
    The disk Input/Output Operations Per Second
    envId Double
    The ID of the environment you would like to deploy your Database in. The Environment does not have to be the same as the primary database, but the Environment does have to be in the same Stack as the primary Database. See main provider documentation for more on how to determine what you should use for env_id.
    handle String
    The handle for the Database. This must be all lower case, and only contain letters, numbers, -, _, or .
    primaryDatabaseId Double
    The ID of the Database the replica is being created from.
    aptibleReplicaId String
    containerProfile String
    Changes the CPU:RAM ratio of the Database container.
    containerSize Double
    The size of container used for the Database, in MB of RAM.
    diskSize Double
    The disk size of the Database, in GB.
    enableBackups Boolean
    Whether to automatically backup the database according to the retention policy.
    iops Double
    The disk Input/Output Operations Per Second
    envId number
    The ID of the environment you would like to deploy your Database in. The Environment does not have to be the same as the primary database, but the Environment does have to be in the same Stack as the primary Database. See main provider documentation for more on how to determine what you should use for env_id.
    handle string
    The handle for the Database. This must be all lower case, and only contain letters, numbers, -, _, or .
    primaryDatabaseId number
    The ID of the Database the replica is being created from.
    aptibleReplicaId string
    containerProfile string
    Changes the CPU:RAM ratio of the Database container.
    containerSize number
    The size of container used for the Database, in MB of RAM.
    diskSize number
    The disk size of the Database, in GB.
    enableBackups boolean
    Whether to automatically backup the database according to the retention policy.
    iops number
    The disk Input/Output Operations Per Second
    env_id float
    The ID of the environment you would like to deploy your Database in. The Environment does not have to be the same as the primary database, but the Environment does have to be in the same Stack as the primary Database. See main provider documentation for more on how to determine what you should use for env_id.
    handle str
    The handle for the Database. This must be all lower case, and only contain letters, numbers, -, _, or .
    primary_database_id float
    The ID of the Database the replica is being created from.
    aptible_replica_id str
    container_profile str
    Changes the CPU:RAM ratio of the Database container.
    container_size float
    The size of container used for the Database, in MB of RAM.
    disk_size float
    The disk size of the Database, in GB.
    enable_backups bool
    Whether to automatically backup the database according to the retention policy.
    iops float
    The disk Input/Output Operations Per Second
    envId Number
    The ID of the environment you would like to deploy your Database in. The Environment does not have to be the same as the primary database, but the Environment does have to be in the same Stack as the primary Database. See main provider documentation for more on how to determine what you should use for env_id.
    handle String
    The handle for the Database. This must be all lower case, and only contain letters, numbers, -, _, or .
    primaryDatabaseId Number
    The ID of the Database the replica is being created from.
    aptibleReplicaId String
    containerProfile String
    Changes the CPU:RAM ratio of the Database container.
    containerSize Number
    The size of container used for the Database, in MB of RAM.
    diskSize Number
    The disk size of the Database, in GB.
    enableBackups Boolean
    Whether to automatically backup the database according to the retention policy.
    iops Number
    The disk Input/Output Operations Per Second

    Outputs

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

    DefaultConnectionUrl string
    The default database credentials in connection URL format
    Id string
    The provider-assigned unique ID for this managed resource.
    ReplicaId double
    The unique ID for the replica
    DefaultConnectionUrl string
    The default database credentials in connection URL format
    Id string
    The provider-assigned unique ID for this managed resource.
    ReplicaId float64
    The unique ID for the replica
    defaultConnectionUrl String
    The default database credentials in connection URL format
    id String
    The provider-assigned unique ID for this managed resource.
    replicaId Double
    The unique ID for the replica
    defaultConnectionUrl string
    The default database credentials in connection URL format
    id string
    The provider-assigned unique ID for this managed resource.
    replicaId number
    The unique ID for the replica
    default_connection_url str
    The default database credentials in connection URL format
    id str
    The provider-assigned unique ID for this managed resource.
    replica_id float
    The unique ID for the replica
    defaultConnectionUrl String
    The default database credentials in connection URL format
    id String
    The provider-assigned unique ID for this managed resource.
    replicaId Number
    The unique ID for the replica

    Look up Existing Replica Resource

    Get an existing Replica 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?: ReplicaState, opts?: CustomResourceOptions): Replica
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            aptible_replica_id: Optional[str] = None,
            container_profile: Optional[str] = None,
            container_size: Optional[float] = None,
            default_connection_url: Optional[str] = None,
            disk_size: Optional[float] = None,
            enable_backups: Optional[bool] = None,
            env_id: Optional[float] = None,
            handle: Optional[str] = None,
            iops: Optional[float] = None,
            primary_database_id: Optional[float] = None,
            replica_id: Optional[float] = None) -> Replica
    func GetReplica(ctx *Context, name string, id IDInput, state *ReplicaState, opts ...ResourceOption) (*Replica, error)
    public static Replica Get(string name, Input<string> id, ReplicaState? state, CustomResourceOptions? opts = null)
    public static Replica get(String name, Output<String> id, ReplicaState state, CustomResourceOptions options)
    resources:  _:    type: aptible:Replica    get:      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:
    AptibleReplicaId string
    ContainerProfile string
    Changes the CPU:RAM ratio of the Database container.
    ContainerSize double
    The size of container used for the Database, in MB of RAM.
    DefaultConnectionUrl string
    The default database credentials in connection URL format
    DiskSize double
    The disk size of the Database, in GB.
    EnableBackups bool
    Whether to automatically backup the database according to the retention policy.
    EnvId double
    The ID of the environment you would like to deploy your Database in. The Environment does not have to be the same as the primary database, but the Environment does have to be in the same Stack as the primary Database. See main provider documentation for more on how to determine what you should use for env_id.
    Handle string
    The handle for the Database. This must be all lower case, and only contain letters, numbers, -, _, or .
    Iops double
    The disk Input/Output Operations Per Second
    PrimaryDatabaseId double
    The ID of the Database the replica is being created from.
    ReplicaId double
    The unique ID for the replica
    AptibleReplicaId string
    ContainerProfile string
    Changes the CPU:RAM ratio of the Database container.
    ContainerSize float64
    The size of container used for the Database, in MB of RAM.
    DefaultConnectionUrl string
    The default database credentials in connection URL format
    DiskSize float64
    The disk size of the Database, in GB.
    EnableBackups bool
    Whether to automatically backup the database according to the retention policy.
    EnvId float64
    The ID of the environment you would like to deploy your Database in. The Environment does not have to be the same as the primary database, but the Environment does have to be in the same Stack as the primary Database. See main provider documentation for more on how to determine what you should use for env_id.
    Handle string
    The handle for the Database. This must be all lower case, and only contain letters, numbers, -, _, or .
    Iops float64
    The disk Input/Output Operations Per Second
    PrimaryDatabaseId float64
    The ID of the Database the replica is being created from.
    ReplicaId float64
    The unique ID for the replica
    aptibleReplicaId String
    containerProfile String
    Changes the CPU:RAM ratio of the Database container.
    containerSize Double
    The size of container used for the Database, in MB of RAM.
    defaultConnectionUrl String
    The default database credentials in connection URL format
    diskSize Double
    The disk size of the Database, in GB.
    enableBackups Boolean
    Whether to automatically backup the database according to the retention policy.
    envId Double
    The ID of the environment you would like to deploy your Database in. The Environment does not have to be the same as the primary database, but the Environment does have to be in the same Stack as the primary Database. See main provider documentation for more on how to determine what you should use for env_id.
    handle String
    The handle for the Database. This must be all lower case, and only contain letters, numbers, -, _, or .
    iops Double
    The disk Input/Output Operations Per Second
    primaryDatabaseId Double
    The ID of the Database the replica is being created from.
    replicaId Double
    The unique ID for the replica
    aptibleReplicaId string
    containerProfile string
    Changes the CPU:RAM ratio of the Database container.
    containerSize number
    The size of container used for the Database, in MB of RAM.
    defaultConnectionUrl string
    The default database credentials in connection URL format
    diskSize number
    The disk size of the Database, in GB.
    enableBackups boolean
    Whether to automatically backup the database according to the retention policy.
    envId number
    The ID of the environment you would like to deploy your Database in. The Environment does not have to be the same as the primary database, but the Environment does have to be in the same Stack as the primary Database. See main provider documentation for more on how to determine what you should use for env_id.
    handle string
    The handle for the Database. This must be all lower case, and only contain letters, numbers, -, _, or .
    iops number
    The disk Input/Output Operations Per Second
    primaryDatabaseId number
    The ID of the Database the replica is being created from.
    replicaId number
    The unique ID for the replica
    aptible_replica_id str
    container_profile str
    Changes the CPU:RAM ratio of the Database container.
    container_size float
    The size of container used for the Database, in MB of RAM.
    default_connection_url str
    The default database credentials in connection URL format
    disk_size float
    The disk size of the Database, in GB.
    enable_backups bool
    Whether to automatically backup the database according to the retention policy.
    env_id float
    The ID of the environment you would like to deploy your Database in. The Environment does not have to be the same as the primary database, but the Environment does have to be in the same Stack as the primary Database. See main provider documentation for more on how to determine what you should use for env_id.
    handle str
    The handle for the Database. This must be all lower case, and only contain letters, numbers, -, _, or .
    iops float
    The disk Input/Output Operations Per Second
    primary_database_id float
    The ID of the Database the replica is being created from.
    replica_id float
    The unique ID for the replica
    aptibleReplicaId String
    containerProfile String
    Changes the CPU:RAM ratio of the Database container.
    containerSize Number
    The size of container used for the Database, in MB of RAM.
    defaultConnectionUrl String
    The default database credentials in connection URL format
    diskSize Number
    The disk size of the Database, in GB.
    enableBackups Boolean
    Whether to automatically backup the database according to the retention policy.
    envId Number
    The ID of the environment you would like to deploy your Database in. The Environment does not have to be the same as the primary database, but the Environment does have to be in the same Stack as the primary Database. See main provider documentation for more on how to determine what you should use for env_id.
    handle String
    The handle for the Database. This must be all lower case, and only contain letters, numbers, -, _, or .
    iops Number
    The disk Input/Output Operations Per Second
    primaryDatabaseId Number
    The ID of the Database the replica is being created from.
    replicaId Number
    The unique ID for the replica

    Import

    Existing Replica can be imported using the Replica ID. For example:

    bash

    $ pulumi import aptible:index/replica:Replica example-replica <ID>
    

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

    Package Details

    Repository
    aptible aptible/terraform-provider-aptible
    License
    Notes
    This Pulumi package is based on the aptible Terraform Provider.
    aptible logo
    aptible 0.9.12 published on Monday, Apr 14, 2025 by aptible