UNPKG

@pulumi/gcp

Version:

A Pulumi package for creating and managing Google Cloud Platform resources.

233 lines • 9.92 kB
import * as pulumi from "@pulumi/pulumi"; /** * Represents a SQL database inside the Cloud SQL instance, hosted in * Google's cloud. * * ## Example Usage * * ### Sql Database Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * // See versions at https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/sql_database_instance#database_version * const instance = new gcp.sql.DatabaseInstance("instance", { * name: "my-database-instance", * region: "us-central1", * databaseVersion: "MYSQL_8_0", * settings: { * tier: "db-f1-micro", * }, * deletionProtection: true, * }); * const database = new gcp.sql.Database("database", { * name: "my-database", * instance: instance.name, * }); * ``` * ### Sql Database Deletion Policy * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * // See versions at https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/sql_database_instance#database_version * const instance = new gcp.sql.DatabaseInstance("instance", { * name: "my-database-instance", * region: "us-central1", * databaseVersion: "POSTGRES_14", * settings: { * tier: "db-g1-small", * }, * deletionProtection: true, * }); * const databaseDeletionPolicy = new gcp.sql.Database("database_deletion_policy", { * name: "my-database", * instance: instance.name, * deletionPolicy: "ABANDON", * }); * ``` * * ## 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:sql/database:Database default projects/{{project}}/instances/{{instance}}/databases/{{name}} * $ pulumi import gcp:sql/database:Database default instances/{{instance}}/databases/{{name}} * $ pulumi import gcp:sql/database:Database default {{project}}/{{instance}}/{{name}} * $ pulumi import gcp:sql/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 charset value. See MySQL's * [Supported Character Sets and Collations](https://dev.mysql.com/doc/refman/5.7/en/charset-charsets.html) * and Postgres' [Character Set Support](https://www.postgresql.org/docs/9.6/static/multibyte.html) * for more details and supported values. Postgres databases only support * a value of `UTF8` at creation time. */ readonly charset: pulumi.Output<string>; /** * The collation value. See MySQL's * [Supported Character Sets and Collations](https://dev.mysql.com/doc/refman/5.7/en/charset-charsets.html) * and Postgres' [Collation Support](https://www.postgresql.org/docs/9.6/static/collation.html) * for more details and supported values. Postgres databases only support * a value of `en_US.UTF8` at creation time. */ readonly collation: pulumi.Output<string>; /** * Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. * When a 'terraform destroy' or 'pulumi up' would delete the resource, * the command will fail if this field is set to "PREVENT" in Terraform state. * When set to "ABANDON", the command will remove the resource from Terraform * management without updating or deleting the resource in the API. * When set to "DELETE", deleting the resource is allowed. */ readonly deletionPolicy: pulumi.Output<string>; /** * The name of the Cloud SQL instance. This does not include the project * ID. */ readonly instance: pulumi.Output<string>; /** * The name of the database in the Cloud SQL instance. * This does not include the project ID or instance name. */ 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>; /** * The URI of the created resource. */ readonly selfLink: 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 charset value. See MySQL's * [Supported Character Sets and Collations](https://dev.mysql.com/doc/refman/5.7/en/charset-charsets.html) * and Postgres' [Character Set Support](https://www.postgresql.org/docs/9.6/static/multibyte.html) * for more details and supported values. Postgres databases only support * a value of `UTF8` at creation time. */ charset?: pulumi.Input<string | undefined>; /** * The collation value. See MySQL's * [Supported Character Sets and Collations](https://dev.mysql.com/doc/refman/5.7/en/charset-charsets.html) * and Postgres' [Collation Support](https://www.postgresql.org/docs/9.6/static/collation.html) * for more details and supported values. Postgres databases only support * a value of `en_US.UTF8` at creation time. */ collation?: pulumi.Input<string | undefined>; /** * Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. * When a 'terraform destroy' or 'pulumi up' would delete the resource, * the command will fail if this field is set to "PREVENT" in Terraform state. * When set to "ABANDON", the command will remove the resource from Terraform * management without updating or deleting the resource in the API. * When set to "DELETE", deleting the resource is allowed. */ deletionPolicy?: pulumi.Input<string | undefined>; /** * The name of the Cloud SQL instance. This does not include the project * ID. */ instance?: pulumi.Input<string | undefined>; /** * The name of the database in the Cloud SQL instance. * This does not include the project ID or instance name. */ name?: pulumi.Input<string | undefined>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input<string | undefined>; /** * The URI of the created resource. */ selfLink?: pulumi.Input<string | undefined>; } /** * The set of arguments for constructing a Database resource. */ export interface DatabaseArgs { /** * The charset value. See MySQL's * [Supported Character Sets and Collations](https://dev.mysql.com/doc/refman/5.7/en/charset-charsets.html) * and Postgres' [Character Set Support](https://www.postgresql.org/docs/9.6/static/multibyte.html) * for more details and supported values. Postgres databases only support * a value of `UTF8` at creation time. */ charset?: pulumi.Input<string | undefined>; /** * The collation value. See MySQL's * [Supported Character Sets and Collations](https://dev.mysql.com/doc/refman/5.7/en/charset-charsets.html) * and Postgres' [Collation Support](https://www.postgresql.org/docs/9.6/static/collation.html) * for more details and supported values. Postgres databases only support * a value of `en_US.UTF8` at creation time. */ collation?: pulumi.Input<string | undefined>; /** * Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. * When a 'terraform destroy' or 'pulumi up' would delete the resource, * the command will fail if this field is set to "PREVENT" in Terraform state. * When set to "ABANDON", the command will remove the resource from Terraform * management without updating or deleting the resource in the API. * When set to "DELETE", deleting the resource is allowed. */ deletionPolicy?: pulumi.Input<string | undefined>; /** * The name of the Cloud SQL instance. This does not include the project * ID. */ instance: pulumi.Input<string>; /** * The name of the database in the Cloud SQL instance. * This does not include the project ID or instance name. */ name?: pulumi.Input<string | undefined>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input<string | undefined>; } //# sourceMappingURL=database.d.ts.map