aptible.Database
Explore with Pulumi AI
# Aptible Database Resource
This resource is used to create and manage Databases running on Aptible Deploy.
!> Changing the handle of a database will destroy the existing database and create a new one, resulting in a database without data. The old database can still be recovered by restoring a backup as long as your retention policy supports final backups.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aptible from "@pulumi/aptible";
const exampleDatabase = new aptible.Database("exampleDatabase", {
containerSize: 512,
databaseType: "redis",
diskSize: 10,
envId: 123,
handle: "example_database",
version: "",
});
import pulumi
import pulumi_aptible as aptible
example_database = aptible.Database("exampleDatabase",
container_size=512,
database_type="redis",
disk_size=10,
env_id=123,
handle="example_database",
version="")
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.NewDatabase(ctx, "exampleDatabase", &aptible.DatabaseArgs{
ContainerSize: pulumi.Float64(512),
DatabaseType: pulumi.String("redis"),
DiskSize: pulumi.Float64(10),
EnvId: pulumi.Float64(123),
Handle: pulumi.String("example_database"),
Version: pulumi.String(""),
})
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 exampleDatabase = new Aptible.Database("exampleDatabase", new()
{
ContainerSize = 512,
DatabaseType = "redis",
DiskSize = 10,
EnvId = 123,
Handle = "example_database",
Version = "",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aptible.Database;
import com.pulumi.aptible.DatabaseArgs;
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 exampleDatabase = new Database("exampleDatabase", DatabaseArgs.builder()
.containerSize(512)
.databaseType("redis")
.diskSize(10)
.envId(123)
.handle("example_database")
.version("")
.build());
}
}
resources:
exampleDatabase:
type: aptible:Database
properties:
containerSize: 512
databaseType: redis
diskSize: 10
envId: 123
handle: example_database
version: ""
Create Database Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Database(name: string, args: DatabaseArgs, opts?: CustomResourceOptions);
@overload
def Database(resource_name: str,
args: DatabaseArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Database(resource_name: str,
opts: Optional[ResourceOptions] = None,
env_id: Optional[float] = None,
handle: Optional[str] = None,
aptible_database_id: Optional[str] = None,
container_profile: Optional[str] = None,
container_size: Optional[float] = None,
database_type: Optional[str] = None,
disk_size: Optional[float] = None,
enable_backups: Optional[bool] = None,
iops: Optional[float] = None,
version: Optional[str] = None)
func NewDatabase(ctx *Context, name string, args DatabaseArgs, opts ...ResourceOption) (*Database, error)
public Database(string name, DatabaseArgs args, CustomResourceOptions? opts = null)
public Database(String name, DatabaseArgs args)
public Database(String name, DatabaseArgs args, CustomResourceOptions options)
type: aptible:Database
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 DatabaseArgs
- 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 DatabaseArgs
- 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 DatabaseArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args DatabaseArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args DatabaseArgs
- 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 databaseResource = new Aptible.Database("databaseResource", new()
{
EnvId = 0,
Handle = "string",
AptibleDatabaseId = "string",
ContainerProfile = "string",
ContainerSize = 0,
DatabaseType = "string",
DiskSize = 0,
EnableBackups = false,
Iops = 0,
Version = "string",
});
example, err := aptible.NewDatabase(ctx, "databaseResource", &aptible.DatabaseArgs{
EnvId: pulumi.Float64(0),
Handle: pulumi.String("string"),
AptibleDatabaseId: pulumi.String("string"),
ContainerProfile: pulumi.String("string"),
ContainerSize: pulumi.Float64(0),
DatabaseType: pulumi.String("string"),
DiskSize: pulumi.Float64(0),
EnableBackups: pulumi.Bool(false),
Iops: pulumi.Float64(0),
Version: pulumi.String("string"),
})
var databaseResource = new Database("databaseResource", DatabaseArgs.builder()
.envId(0)
.handle("string")
.aptibleDatabaseId("string")
.containerProfile("string")
.containerSize(0)
.databaseType("string")
.diskSize(0)
.enableBackups(false)
.iops(0)
.version("string")
.build());
database_resource = aptible.Database("databaseResource",
env_id=0,
handle="string",
aptible_database_id="string",
container_profile="string",
container_size=0,
database_type="string",
disk_size=0,
enable_backups=False,
iops=0,
version="string")
const databaseResource = new aptible.Database("databaseResource", {
envId: 0,
handle: "string",
aptibleDatabaseId: "string",
containerProfile: "string",
containerSize: 0,
databaseType: "string",
diskSize: 0,
enableBackups: false,
iops: 0,
version: "string",
});
type: aptible:Database
properties:
aptibleDatabaseId: string
containerProfile: string
containerSize: 0
databaseType: string
diskSize: 0
enableBackups: false
envId: 0
handle: string
iops: 0
version: string
Database 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 Database resource accepts the following input properties:
- Env
Id double - The ID of the environment you would like to deploy your
Database in. 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.
- Aptible
Database 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.
- Database
Type string - The type of Database.
- 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
- Version string
- The version of the Database. If none is specified, this defaults to the latest recommended version.
- Env
Id float64 - The ID of the environment you would like to deploy your
Database in. 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.
- Aptible
Database 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.
- Database
Type string - The type of Database.
- 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
- Version string
- The version of the Database. If none is specified, this defaults to the latest recommended version.
- env
Id Double - The ID of the environment you would like to deploy your
Database in. 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.
- aptible
Database 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.
- database
Type String - The type of Database.
- 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
- version String
- The version of the Database. If none is specified, this defaults to the latest recommended version.
- env
Id number - The ID of the environment you would like to deploy your
Database in. 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.
- aptible
Database 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.
- database
Type string - The type of Database.
- 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
- version string
- The version of the Database. If none is specified, this defaults to the latest recommended version.
- env_
id float - The ID of the environment you would like to deploy your
Database in. 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.
- aptible_
database_ 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.
- database_
type str - The type of Database.
- 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
- version str
- The version of the Database. If none is specified, this defaults to the latest recommended version.
- env
Id Number - The ID of the environment you would like to deploy your
Database in. 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.
- aptible
Database 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.
- database
Type String - The type of Database.
- 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
- version String
- The version of the Database. If none is specified, this defaults to the latest recommended version.
Outputs
All input properties are implicitly available as output properties. Additionally, the Database resource produces the following output properties:
- Connection
Urls List<string> - A list of all available database credentials in connection URL format
- Database
Id double - The unique ID for the database
- Database
Image doubleId - The image used for running the database. Normally only used for support or debugging purposes
- Default
Connection stringUrl - The default database credentials in connection URL format
- Id string
- The provider-assigned unique ID for this managed resource.
- Connection
Urls []string - A list of all available database credentials in connection URL format
- Database
Id float64 - The unique ID for the database
- Database
Image float64Id - The image used for running the database. Normally only used for support or debugging purposes
- Default
Connection stringUrl - The default database credentials in connection URL format
- Id string
- The provider-assigned unique ID for this managed resource.
- connection
Urls List<String> - A list of all available database credentials in connection URL format
- database
Id Double - The unique ID for the database
- database
Image DoubleId - The image used for running the database. Normally only used for support or debugging purposes
- default
Connection StringUrl - The default database credentials in connection URL format
- id String
- The provider-assigned unique ID for this managed resource.
- connection
Urls string[] - A list of all available database credentials in connection URL format
- database
Id number - The unique ID for the database
- database
Image numberId - The image used for running the database. Normally only used for support or debugging purposes
- default
Connection stringUrl - The default database credentials in connection URL format
- id string
- The provider-assigned unique ID for this managed resource.
- connection_
urls Sequence[str] - A list of all available database credentials in connection URL format
- database_
id float - The unique ID for the database
- database_
image_ floatid - The image used for running the database. Normally only used for support or debugging purposes
- default_
connection_ strurl - The default database credentials in connection URL format
- id str
- The provider-assigned unique ID for this managed resource.
- connection
Urls List<String> - A list of all available database credentials in connection URL format
- database
Id Number - The unique ID for the database
- database
Image NumberId - The image used for running the database. Normally only used for support or debugging purposes
- default
Connection StringUrl - The default database credentials in connection URL format
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing Database Resource
Get an existing Database 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?: DatabaseState, opts?: CustomResourceOptions): Database
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
aptible_database_id: Optional[str] = None,
connection_urls: Optional[Sequence[str]] = None,
container_profile: Optional[str] = None,
container_size: Optional[float] = None,
database_id: Optional[float] = None,
database_image_id: Optional[float] = None,
database_type: Optional[str] = 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,
version: Optional[str] = None) -> Database
func GetDatabase(ctx *Context, name string, id IDInput, state *DatabaseState, opts ...ResourceOption) (*Database, error)
public static Database Get(string name, Input<string> id, DatabaseState? state, CustomResourceOptions? opts = null)
public static Database get(String name, Output<String> id, DatabaseState state, CustomResourceOptions options)
resources: _: type: aptible:Database 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
Database stringId - Connection
Urls List<string> - A list of all available database credentials in connection URL format
- 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.
- Database
Id double - The unique ID for the database
- Database
Image doubleId - The image used for running the database. Normally only used for support or debugging purposes
- Database
Type string - The type of Database.
- 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. 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
- Version string
- The version of the Database. If none is specified, this defaults to the latest recommended version.
- Aptible
Database stringId - Connection
Urls []string - A list of all available database credentials in connection URL format
- 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.
- Database
Id float64 - The unique ID for the database
- Database
Image float64Id - The image used for running the database. Normally only used for support or debugging purposes
- Database
Type string - The type of Database.
- 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. 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
- Version string
- The version of the Database. If none is specified, this defaults to the latest recommended version.
- aptible
Database StringId - connection
Urls List<String> - A list of all available database credentials in connection URL format
- 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.
- database
Id Double - The unique ID for the database
- database
Image DoubleId - The image used for running the database. Normally only used for support or debugging purposes
- database
Type String - The type of Database.
- 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. 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
- version String
- The version of the Database. If none is specified, this defaults to the latest recommended version.
- aptible
Database stringId - connection
Urls string[] - A list of all available database credentials in connection URL format
- 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.
- database
Id number - The unique ID for the database
- database
Image numberId - The image used for running the database. Normally only used for support or debugging purposes
- database
Type string - The type of Database.
- 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. 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
- version string
- The version of the Database. If none is specified, this defaults to the latest recommended version.
- aptible_
database_ strid - connection_
urls Sequence[str] - A list of all available database credentials in connection URL format
- 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.
- database_
id float - The unique ID for the database
- database_
image_ floatid - The image used for running the database. Normally only used for support or debugging purposes
- database_
type str - The type of Database.
- 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. 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
- version str
- The version of the Database. If none is specified, this defaults to the latest recommended version.
- aptible
Database StringId - connection
Urls List<String> - A list of all available database credentials in connection URL format
- 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.
- database
Id Number - The unique ID for the database
- database
Image NumberId - The image used for running the database. Normally only used for support or debugging purposes
- database
Type String - The type of Database.
- 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. 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
- version String
- The version of the Database. If none is specified, this defaults to the latest recommended version.
Import
Existing Databases can be imported using the Database ID. For example:
bash
$ pulumi import aptible:index/database:Database example-database <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.