UNPKG

@pulumi/digitalocean

Version:

A Pulumi package for creating and managing DigitalOcean cloud resources.

456 lines (455 loc) • 17.2 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "./types/input"; import * as outputs from "./types/output"; import * as enums from "./types/enums"; /** * Provides a DigitalOcean database cluster resource. * * ## Example Usage * * ### Create a new PostgreSQL database cluster * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as digitalocean from "@pulumi/digitalocean"; * * const postgres_example = new digitalocean.DatabaseCluster("postgres-example", { * name: "example-postgres-cluster", * engine: "pg", * version: "15", * size: digitalocean.DatabaseSlug.DB_1VPCU1GB, * region: digitalocean.Region.NYC1, * nodeCount: 1, * }); * ``` * * ### Create a new MySQL database cluster * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as digitalocean from "@pulumi/digitalocean"; * * const mysql_example = new digitalocean.DatabaseCluster("mysql-example", { * name: "example-mysql-cluster", * engine: "mysql", * version: "8", * size: digitalocean.DatabaseSlug.DB_1VPCU1GB, * region: digitalocean.Region.NYC1, * nodeCount: 1, * }); * ``` * * ### Create a new Valkey database cluster * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as digitalocean from "@pulumi/digitalocean"; * * const valkey_example = new digitalocean.DatabaseCluster("valkey-example", { * name: "example-valkey-cluster", * engine: "valkey", * version: "8", * size: digitalocean.DatabaseSlug.DB_1VPCU1GB, * region: digitalocean.Region.NYC1, * nodeCount: 1, * }); * ``` * * ### Create a new Kafka database cluster * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as digitalocean from "@pulumi/digitalocean"; * * const kafka_example = new digitalocean.DatabaseCluster("kafka-example", { * name: "example-kafka-cluster", * engine: "kafka", * version: "3.5", * size: "db-s-2vcpu-2gb", * region: digitalocean.Region.NYC1, * nodeCount: 3, * }); * ``` * * ### Create a new MongoDB database cluster * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as digitalocean from "@pulumi/digitalocean"; * * const mongodb_example = new digitalocean.DatabaseCluster("mongodb-example", { * name: "example-mongo-cluster", * engine: "mongodb", * version: "6", * size: digitalocean.DatabaseSlug.DB_1VPCU1GB, * region: digitalocean.Region.NYC3, * nodeCount: 1, * }); * ``` * * ### Create a new OpenSearch database cluster * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as digitalocean from "@pulumi/digitalocean"; * * const opensearch_example = new digitalocean.DatabaseCluster("opensearch-example", { * name: "example-opensearch-cluster", * engine: "opensearch", * version: "2", * size: digitalocean.DatabaseSlug.DB_1VPCU2GB, * region: digitalocean.Region.NYC3, * nodeCount: 1, * }); * ``` * * ## Create a new database cluster based on a backup of an existing cluster. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as digitalocean from "@pulumi/digitalocean"; * * const doby = new digitalocean.DatabaseCluster("doby", { * name: "dobydb", * engine: "pg", * version: "15", * size: digitalocean.DatabaseSlug.DB_1VPCU2GB, * region: digitalocean.Region.NYC1, * nodeCount: 1, * tags: ["production"], * }); * const dobyBackup = new digitalocean.DatabaseCluster("doby_backup", { * name: "dobydupe", * engine: "pg", * version: "15", * size: digitalocean.DatabaseSlug.DB_1VPCU2GB, * region: digitalocean.Region.NYC1, * nodeCount: 1, * tags: ["production"], * backupRestore: { * databaseName: "dobydb", * }, * }, { * dependsOn: [doby], * }); * ``` * * ## Import * * Database clusters can be imported using the `id` returned from DigitalOcean, e.g. * * ```sh * $ pulumi import digitalocean:index/databaseCluster:DatabaseCluster mycluster 245bcfd0-7f31-4ce6-a2bc-475a116cca97 * ``` */ export declare class DatabaseCluster extends pulumi.CustomResource { /** * Get an existing DatabaseCluster resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input<pulumi.ID>, state?: DatabaseClusterState, opts?: pulumi.CustomResourceOptions): DatabaseCluster; /** * Returns true if the given object is an instance of DatabaseCluster. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is DatabaseCluster; readonly backupRestore: pulumi.Output<outputs.DatabaseClusterBackupRestore | undefined>; /** * The uniform resource name of the database cluster. */ readonly clusterUrn: pulumi.Output<string>; /** * Name of the cluster's default database. */ readonly database: pulumi.Output<string>; /** * Database engine used by the cluster (ex. `pg` for PostgreSQL, `mysql` for MySQL, `valkey` for Valkey, `mongodb` for MongoDB, or `kafka` for Kafka). */ readonly engine: pulumi.Output<string>; /** * A string specifying the eviction policy for a Valkey cluster. Valid values are: `noeviction`, `allkeysLru`, `allkeysRandom`, `volatileLru`, `volatileRandom`, or `volatileTtl`. */ readonly evictionPolicy: pulumi.Output<string | undefined>; /** * Database cluster's hostname. */ readonly host: pulumi.Output<string>; /** * Defines when the automatic maintenance should be performed for the database cluster. */ readonly maintenanceWindows: pulumi.Output<outputs.DatabaseClusterMaintenanceWindow[] | undefined>; /** * The name of the database cluster. */ readonly name: pulumi.Output<string>; /** * Number of nodes that will be included in the cluster. For `kafka` clusters, this must be 3. */ readonly nodeCount: pulumi.Output<number>; /** * Password for the cluster's default user. */ readonly password: pulumi.Output<string>; /** * Network port that the database cluster is listening on. */ readonly port: pulumi.Output<number>; /** * Same as `host`, but only accessible from resources within the account and in the same region. */ readonly privateHost: pulumi.Output<string>; /** * The ID of the VPC where the database cluster will be located. */ readonly privateNetworkUuid: pulumi.Output<string>; /** * Same as `uri`, but only accessible from resources within the account and in the same region. */ readonly privateUri: pulumi.Output<string>; /** * The ID of the project that the database cluster is assigned to. If excluded when creating a new database cluster, it will be assigned to your default project. */ readonly projectId: pulumi.Output<string>; /** * DigitalOcean region where the cluster will reside. */ readonly region: pulumi.Output<string>; /** * Database Droplet size associated with the cluster (ex. `db-s-1vcpu-1gb`). See the DigitalOcean API for a [list of valid size slugs](https://docs.digitalocean.com/reference/api/digitalocean/#tag/Databases/operation/databases_list_options). */ readonly size: pulumi.Output<string>; /** * A comma separated string specifying the SQL modes for a MySQL cluster. */ readonly sqlMode: pulumi.Output<string | undefined>; /** * Defines the disk size, in MiB, allocated to the cluster. This can be adjusted on MySQL and PostgreSQL clusters based on predefined ranges for each slug/droplet size. */ readonly storageSizeMib: pulumi.Output<string>; /** * A list of tag names to be applied to the database cluster. */ readonly tags: pulumi.Output<string[] | undefined>; /** * Name of the OpenSearch dashboard db. */ readonly uiDatabase: pulumi.Output<string>; /** * Hostname for the OpenSearch dashboard. */ readonly uiHost: pulumi.Output<string>; /** * Password for the OpenSearch dashboard's default user. */ readonly uiPassword: pulumi.Output<string>; /** * Network port that the OpenSearch dashboard is listening on. */ readonly uiPort: pulumi.Output<number>; /** * The full URI for connecting to the OpenSearch dashboard. */ readonly uiUri: pulumi.Output<string>; /** * Username for OpenSearch dashboard's default user. */ readonly uiUser: pulumi.Output<string>; /** * The full URI for connecting to the database cluster. */ readonly uri: pulumi.Output<string>; /** * Username for the cluster's default user. */ readonly user: pulumi.Output<string>; /** * Engine version used by the cluster (ex. `14` for PostgreSQL 14). * When this value is changed, a call to the [Upgrade major Version for a Database](https://docs.digitalocean.com/reference/api/digitalocean/#tag/Databases/operation/databases_update_major_version) API operation is made with the new version. */ readonly version: pulumi.Output<string | undefined>; /** * Create a DatabaseCluster resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: DatabaseClusterArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering DatabaseCluster resources. */ export interface DatabaseClusterState { backupRestore?: pulumi.Input<inputs.DatabaseClusterBackupRestore>; /** * The uniform resource name of the database cluster. */ clusterUrn?: pulumi.Input<string>; /** * Name of the cluster's default database. */ database?: pulumi.Input<string>; /** * Database engine used by the cluster (ex. `pg` for PostgreSQL, `mysql` for MySQL, `valkey` for Valkey, `mongodb` for MongoDB, or `kafka` for Kafka). */ engine?: pulumi.Input<string>; /** * A string specifying the eviction policy for a Valkey cluster. Valid values are: `noeviction`, `allkeysLru`, `allkeysRandom`, `volatileLru`, `volatileRandom`, or `volatileTtl`. */ evictionPolicy?: pulumi.Input<string>; /** * Database cluster's hostname. */ host?: pulumi.Input<string>; /** * Defines when the automatic maintenance should be performed for the database cluster. */ maintenanceWindows?: pulumi.Input<pulumi.Input<inputs.DatabaseClusterMaintenanceWindow>[]>; /** * The name of the database cluster. */ name?: pulumi.Input<string>; /** * Number of nodes that will be included in the cluster. For `kafka` clusters, this must be 3. */ nodeCount?: pulumi.Input<number>; /** * Password for the cluster's default user. */ password?: pulumi.Input<string>; /** * Network port that the database cluster is listening on. */ port?: pulumi.Input<number>; /** * Same as `host`, but only accessible from resources within the account and in the same region. */ privateHost?: pulumi.Input<string>; /** * The ID of the VPC where the database cluster will be located. */ privateNetworkUuid?: pulumi.Input<string>; /** * Same as `uri`, but only accessible from resources within the account and in the same region. */ privateUri?: pulumi.Input<string>; /** * The ID of the project that the database cluster is assigned to. If excluded when creating a new database cluster, it will be assigned to your default project. */ projectId?: pulumi.Input<string>; /** * DigitalOcean region where the cluster will reside. */ region?: pulumi.Input<string | enums.Region>; /** * Database Droplet size associated with the cluster (ex. `db-s-1vcpu-1gb`). See the DigitalOcean API for a [list of valid size slugs](https://docs.digitalocean.com/reference/api/digitalocean/#tag/Databases/operation/databases_list_options). */ size?: pulumi.Input<string | enums.DatabaseSlug>; /** * A comma separated string specifying the SQL modes for a MySQL cluster. */ sqlMode?: pulumi.Input<string>; /** * Defines the disk size, in MiB, allocated to the cluster. This can be adjusted on MySQL and PostgreSQL clusters based on predefined ranges for each slug/droplet size. */ storageSizeMib?: pulumi.Input<string>; /** * A list of tag names to be applied to the database cluster. */ tags?: pulumi.Input<pulumi.Input<string>[]>; /** * Name of the OpenSearch dashboard db. */ uiDatabase?: pulumi.Input<string>; /** * Hostname for the OpenSearch dashboard. */ uiHost?: pulumi.Input<string>; /** * Password for the OpenSearch dashboard's default user. */ uiPassword?: pulumi.Input<string>; /** * Network port that the OpenSearch dashboard is listening on. */ uiPort?: pulumi.Input<number>; /** * The full URI for connecting to the OpenSearch dashboard. */ uiUri?: pulumi.Input<string>; /** * Username for OpenSearch dashboard's default user. */ uiUser?: pulumi.Input<string>; /** * The full URI for connecting to the database cluster. */ uri?: pulumi.Input<string>; /** * Username for the cluster's default user. */ user?: pulumi.Input<string>; /** * Engine version used by the cluster (ex. `14` for PostgreSQL 14). * When this value is changed, a call to the [Upgrade major Version for a Database](https://docs.digitalocean.com/reference/api/digitalocean/#tag/Databases/operation/databases_update_major_version) API operation is made with the new version. */ version?: pulumi.Input<string>; } /** * The set of arguments for constructing a DatabaseCluster resource. */ export interface DatabaseClusterArgs { backupRestore?: pulumi.Input<inputs.DatabaseClusterBackupRestore>; /** * Database engine used by the cluster (ex. `pg` for PostgreSQL, `mysql` for MySQL, `valkey` for Valkey, `mongodb` for MongoDB, or `kafka` for Kafka). */ engine: pulumi.Input<string>; /** * A string specifying the eviction policy for a Valkey cluster. Valid values are: `noeviction`, `allkeysLru`, `allkeysRandom`, `volatileLru`, `volatileRandom`, or `volatileTtl`. */ evictionPolicy?: pulumi.Input<string>; /** * Defines when the automatic maintenance should be performed for the database cluster. */ maintenanceWindows?: pulumi.Input<pulumi.Input<inputs.DatabaseClusterMaintenanceWindow>[]>; /** * The name of the database cluster. */ name?: pulumi.Input<string>; /** * Number of nodes that will be included in the cluster. For `kafka` clusters, this must be 3. */ nodeCount: pulumi.Input<number>; /** * The ID of the VPC where the database cluster will be located. */ privateNetworkUuid?: pulumi.Input<string>; /** * The ID of the project that the database cluster is assigned to. If excluded when creating a new database cluster, it will be assigned to your default project. */ projectId?: pulumi.Input<string>; /** * DigitalOcean region where the cluster will reside. */ region: pulumi.Input<string | enums.Region>; /** * Database Droplet size associated with the cluster (ex. `db-s-1vcpu-1gb`). See the DigitalOcean API for a [list of valid size slugs](https://docs.digitalocean.com/reference/api/digitalocean/#tag/Databases/operation/databases_list_options). */ size: pulumi.Input<string | enums.DatabaseSlug>; /** * A comma separated string specifying the SQL modes for a MySQL cluster. */ sqlMode?: pulumi.Input<string>; /** * Defines the disk size, in MiB, allocated to the cluster. This can be adjusted on MySQL and PostgreSQL clusters based on predefined ranges for each slug/droplet size. */ storageSizeMib?: pulumi.Input<string>; /** * A list of tag names to be applied to the database cluster. */ tags?: pulumi.Input<pulumi.Input<string>[]>; /** * Engine version used by the cluster (ex. `14` for PostgreSQL 14). * When this value is changed, a call to the [Upgrade major Version for a Database](https://docs.digitalocean.com/reference/api/digitalocean/#tag/Databases/operation/databases_update_major_version) API operation is made with the new version. */ version?: pulumi.Input<string>; }