aptible.Replica
Explore with Pulumi AI
# 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:
- Env
Id 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.
- Primary
Database doubleId - The ID of the Database the replica is being created from.
- Aptible
Replica stringId - Container
Profile string - Changes the CPU:RAM ratio of the Database container.
- Container
Size double - The size of container used for the Database, in MB of RAM.
- Disk
Size double - The disk size of the Database, in GB.
- Enable
Backups bool - Whether to automatically backup the database according to the retention policy.
- Iops double
- The disk Input/Output Operations Per Second
- Env
Id 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.
- Primary
Database float64Id - The ID of the Database the replica is being created from.
- Aptible
Replica stringId - Container
Profile string - Changes the CPU:RAM ratio of the Database container.
- Container
Size float64 - The size of container used for the Database, in MB of RAM.
- Disk
Size float64 - The disk size of the Database, in GB.
- Enable
Backups bool - Whether to automatically backup the database according to the retention policy.
- Iops float64
- The disk Input/Output Operations Per Second
- env
Id 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.
- primary
Database DoubleId - The ID of the Database the replica is being created from.
- aptible
Replica StringId - container
Profile String - Changes the CPU:RAM ratio of the Database container.
- container
Size Double - The size of container used for the Database, in MB of RAM.
- disk
Size Double - The disk size of the Database, in GB.
- enable
Backups Boolean - Whether to automatically backup the database according to the retention policy.
- iops Double
- The disk Input/Output Operations Per Second
- env
Id 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.
- primary
Database numberId - The ID of the Database the replica is being created from.
- aptible
Replica stringId - container
Profile string - Changes the CPU:RAM ratio of the Database container.
- container
Size number - The size of container used for the Database, in MB of RAM.
- disk
Size number - The disk size of the Database, in GB.
- enable
Backups 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_ floatid - The ID of the Database the replica is being created from.
- aptible_
replica_ strid - 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
- env
Id 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.
- primary
Database NumberId - The ID of the Database the replica is being created from.
- aptible
Replica StringId - container
Profile String - Changes the CPU:RAM ratio of the Database container.
- container
Size Number - The size of container used for the Database, in MB of RAM.
- disk
Size Number - The disk size of the Database, in GB.
- enable
Backups 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:
- Default
Connection stringUrl - The default database credentials in connection URL format
- Id string
- The provider-assigned unique ID for this managed resource.
- Replica
Id double - The unique ID for the replica
- Default
Connection stringUrl - The default database credentials in connection URL format
- Id string
- The provider-assigned unique ID for this managed resource.
- Replica
Id float64 - The unique ID for the replica
- default
Connection StringUrl - The default database credentials in connection URL format
- id String
- The provider-assigned unique ID for this managed resource.
- replica
Id Double - The unique ID for the replica
- default
Connection stringUrl - The default database credentials in connection URL format
- id string
- The provider-assigned unique ID for this managed resource.
- replica
Id number - The unique ID for the replica
- default_
connection_ strurl - 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
- default
Connection StringUrl - The default database credentials in connection URL format
- id String
- The provider-assigned unique ID for this managed resource.
- replica
Id 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.
- Aptible
Replica stringId - Container
Profile string - Changes the CPU:RAM ratio of the Database container.
- Container
Size double - The size of container used for the Database, in MB of RAM.
- Default
Connection stringUrl - The default database credentials in connection URL format
- Disk
Size double - The disk size of the Database, in GB.
- Enable
Backups bool - Whether to automatically backup the database according to the retention policy.
- Env
Id 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
- Primary
Database doubleId - The ID of the Database the replica is being created from.
- Replica
Id double - The unique ID for the replica
- Aptible
Replica stringId - Container
Profile string - Changes the CPU:RAM ratio of the Database container.
- Container
Size float64 - The size of container used for the Database, in MB of RAM.
- Default
Connection stringUrl - The default database credentials in connection URL format
- Disk
Size float64 - The disk size of the Database, in GB.
- Enable
Backups bool - Whether to automatically backup the database according to the retention policy.
- Env
Id 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
- Primary
Database float64Id - The ID of the Database the replica is being created from.
- Replica
Id float64 - The unique ID for the replica
- aptible
Replica StringId - container
Profile String - Changes the CPU:RAM ratio of the Database container.
- container
Size Double - The size of container used for the Database, in MB of RAM.
- default
Connection StringUrl - The default database credentials in connection URL format
- disk
Size Double - The disk size of the Database, in GB.
- enable
Backups Boolean - Whether to automatically backup the database according to the retention policy.
- env
Id 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
- primary
Database DoubleId - The ID of the Database the replica is being created from.
- replica
Id Double - The unique ID for the replica
- aptible
Replica stringId - container
Profile string - Changes the CPU:RAM ratio of the Database container.
- container
Size number - The size of container used for the Database, in MB of RAM.
- default
Connection stringUrl - The default database credentials in connection URL format
- disk
Size number - The disk size of the Database, in GB.
- enable
Backups boolean - Whether to automatically backup the database according to the retention policy.
- env
Id 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
- primary
Database numberId - The ID of the Database the replica is being created from.
- replica
Id number - The unique ID for the replica
- aptible_
replica_ strid - 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_ strurl - 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_ floatid - The ID of the Database the replica is being created from.
- replica_
id float - The unique ID for the replica
- aptible
Replica StringId - container
Profile String - Changes the CPU:RAM ratio of the Database container.
- container
Size Number - The size of container used for the Database, in MB of RAM.
- default
Connection StringUrl - The default database credentials in connection URL format
- disk
Size Number - The disk size of the Database, in GB.
- enable
Backups Boolean - Whether to automatically backup the database according to the retention policy.
- env
Id 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
- primary
Database NumberId - The ID of the Database the replica is being created from.
- replica
Id 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.