@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
253 lines (252 loc) • 10.2 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "../types/input";
import * as outputs from "../types/output";
/**
* A Cloud Spanner Database which is hosted on a Spanner instance.
*
* To get more information about Database, see:
*
* * [API documentation](https://cloud.google.com/spanner/docs/reference/rest/v1/projects.instances.databases)
* * How-to Guides
* * [Official Documentation](https://cloud.google.com/spanner/)
*
* > **Warning:** On newer versions of the provider, you must explicitly set `deletion_protection=false`
* (and run `pulumi up` to write the field to state) in order to destroy an instance.
* It is recommended to not set this field (or set it to true) until you're ready to destroy.
* On older versions, it is strongly recommended to set `lifecycle { preventDestroy = true }`
* on databases in order to prevent accidental data loss.
*
* ## Example Usage
*
* ### Spanner Database Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const main = new gcp.spanner.Instance("main", {
* config: "regional-europe-west1",
* displayName: "main-instance",
* numNodes: 1,
* });
* const database = new gcp.spanner.Database("database", {
* instance: main.name,
* name: "my-database",
* versionRetentionPeriod: "3d",
* defaultTimeZone: "UTC",
* ddls: [
* "CREATE TABLE t1 (t1 INT64 NOT NULL,) PRIMARY KEY(t1)",
* "CREATE TABLE t2 (t2 INT64 NOT NULL,) PRIMARY KEY(t2)",
* ],
* deletionProtection: false,
* });
* ```
*
* ## Import
*
* Database can be imported using any of these accepted formats:
*
* * `projects/{{project}}/instances/{{instance}}/databases/{{name}}`
*
* * `instances/{{instance}}/databases/{{name}}`
*
* * `{{project}}/{{instance}}/{{name}}`
*
* * `{{instance}}/{{name}}`
*
* When using the `pulumi import` command, Database can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:spanner/database:Database default projects/{{project}}/instances/{{instance}}/databases/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:spanner/database:Database default instances/{{instance}}/databases/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:spanner/database:Database default {{project}}/{{instance}}/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:spanner/database:Database default {{instance}}/{{name}}
* ```
*/
export declare class Database extends pulumi.CustomResource {
/**
* Get an existing Database 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?: DatabaseState, opts?: pulumi.CustomResourceOptions): Database;
/**
* Returns true if the given object is an instance of Database. 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 Database;
/**
* The dialect of the Cloud Spanner Database.
* If it is not provided, "GOOGLE_STANDARD_SQL" will be used.
* Possible values are: `GOOGLE_STANDARD_SQL`, `POSTGRESQL`.
*/
readonly databaseDialect: pulumi.Output<string>;
readonly ddls: pulumi.Output<string[] | undefined>;
/**
* The default time zone for the database. The default time zone must be a valid name
* from the tz database. Default value is "America/Los_angeles".
*/
readonly defaultTimeZone: pulumi.Output<string | undefined>;
/**
* Whether or not to allow the provider to destroy the instance. Unless this field is set to false
* in state, a `destroy` or `update` that would delete the instance will fail.
*/
readonly deletionProtection: pulumi.Output<boolean | undefined>;
readonly enableDropProtection: pulumi.Output<boolean | undefined>;
/**
* Encryption configuration for the database
* Structure is documented below.
*/
readonly encryptionConfig: pulumi.Output<outputs.spanner.DatabaseEncryptionConfig | undefined>;
/**
* The instance to create the database on.
*/
readonly instance: pulumi.Output<string>;
/**
* A unique identifier for the database, which cannot be changed after the
* instance is created. Values are of the form `[a-z][-_a-z0-9]*[a-z0-9]`.
*/
readonly name: pulumi.Output<string>;
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
readonly project: pulumi.Output<string>;
/**
* An explanation of the status of the database.
*/
readonly state: pulumi.Output<string>;
/**
* The retention period for the database. The retention period must be between 1 hour
* and 7 days, and can be specified in days, hours, minutes, or seconds. For example,
* the values 1d, 24h, 1440m, and 86400s are equivalent. Default value is 1h.
* If this property is used, you must avoid adding new DDL statements to `ddl` that
* update the database's version_retention_period.
*/
readonly versionRetentionPeriod: pulumi.Output<string>;
/**
* Create a Database 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: DatabaseArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering Database resources.
*/
export interface DatabaseState {
/**
* The dialect of the Cloud Spanner Database.
* If it is not provided, "GOOGLE_STANDARD_SQL" will be used.
* Possible values are: `GOOGLE_STANDARD_SQL`, `POSTGRESQL`.
*/
databaseDialect?: pulumi.Input<string>;
ddls?: pulumi.Input<pulumi.Input<string>[]>;
/**
* The default time zone for the database. The default time zone must be a valid name
* from the tz database. Default value is "America/Los_angeles".
*/
defaultTimeZone?: pulumi.Input<string>;
/**
* Whether or not to allow the provider to destroy the instance. Unless this field is set to false
* in state, a `destroy` or `update` that would delete the instance will fail.
*/
deletionProtection?: pulumi.Input<boolean>;
enableDropProtection?: pulumi.Input<boolean>;
/**
* Encryption configuration for the database
* Structure is documented below.
*/
encryptionConfig?: pulumi.Input<inputs.spanner.DatabaseEncryptionConfig>;
/**
* The instance to create the database on.
*/
instance?: pulumi.Input<string>;
/**
* A unique identifier for the database, which cannot be changed after the
* instance is created. Values are of the form `[a-z][-_a-z0-9]*[a-z0-9]`.
*/
name?: pulumi.Input<string>;
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
project?: pulumi.Input<string>;
/**
* An explanation of the status of the database.
*/
state?: pulumi.Input<string>;
/**
* The retention period for the database. The retention period must be between 1 hour
* and 7 days, and can be specified in days, hours, minutes, or seconds. For example,
* the values 1d, 24h, 1440m, and 86400s are equivalent. Default value is 1h.
* If this property is used, you must avoid adding new DDL statements to `ddl` that
* update the database's version_retention_period.
*/
versionRetentionPeriod?: pulumi.Input<string>;
}
/**
* The set of arguments for constructing a Database resource.
*/
export interface DatabaseArgs {
/**
* The dialect of the Cloud Spanner Database.
* If it is not provided, "GOOGLE_STANDARD_SQL" will be used.
* Possible values are: `GOOGLE_STANDARD_SQL`, `POSTGRESQL`.
*/
databaseDialect?: pulumi.Input<string>;
ddls?: pulumi.Input<pulumi.Input<string>[]>;
/**
* The default time zone for the database. The default time zone must be a valid name
* from the tz database. Default value is "America/Los_angeles".
*/
defaultTimeZone?: pulumi.Input<string>;
/**
* Whether or not to allow the provider to destroy the instance. Unless this field is set to false
* in state, a `destroy` or `update` that would delete the instance will fail.
*/
deletionProtection?: pulumi.Input<boolean>;
enableDropProtection?: pulumi.Input<boolean>;
/**
* Encryption configuration for the database
* Structure is documented below.
*/
encryptionConfig?: pulumi.Input<inputs.spanner.DatabaseEncryptionConfig>;
/**
* The instance to create the database on.
*/
instance: pulumi.Input<string>;
/**
* A unique identifier for the database, which cannot be changed after the
* instance is created. Values are of the form `[a-z][-_a-z0-9]*[a-z0-9]`.
*/
name?: pulumi.Input<string>;
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
project?: pulumi.Input<string>;
/**
* The retention period for the database. The retention period must be between 1 hour
* and 7 days, and can be specified in days, hours, minutes, or seconds. For example,
* the values 1d, 24h, 1440m, and 86400s are equivalent. Default value is 1h.
* If this property is used, you must avoid adding new DDL statements to `ddl` that
* update the database's version_retention_period.
*/
versionRetentionPeriod?: pulumi.Input<string>;
}