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}} * ``` * * ```sh * $ pulumi import gcp:sql/database:Database default instances/{{instance}}/databases/{{name}} * ``` * * ```sh * $ pulumi import gcp:sql/database:Database default {{project}}/{{instance}}/{{name}} * ``` * * ```sh * $ 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, 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; /** * 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; /** * The deletion policy for the database. Setting ABANDON allows the resource * to be abandoned rather than deleted. This is useful for Postgres, where databases cannot be * deleted from the API if there are users other than cloudsqlsuperuser with access. Possible * values are: "ABANDON", "DELETE". Defaults to "DELETE". */ readonly deletionPolicy: pulumi.Output; /** * The name of the Cloud SQL instance. This does not include the project * ID. */ readonly instance: pulumi.Output; /** * The name of the database in the Cloud SQL instance. * This does not include the project ID or instance name. */ readonly name: pulumi.Output; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ readonly project: pulumi.Output; /** * The URI of the created resource. */ readonly selfLink: pulumi.Output; /** * 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; /** * 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; /** * The deletion policy for the database. Setting ABANDON allows the resource * to be abandoned rather than deleted. This is useful for Postgres, where databases cannot be * deleted from the API if there are users other than cloudsqlsuperuser with access. Possible * values are: "ABANDON", "DELETE". Defaults to "DELETE". */ deletionPolicy?: pulumi.Input; /** * The name of the Cloud SQL instance. This does not include the project * ID. */ instance?: pulumi.Input; /** * The name of the database in the Cloud SQL instance. * This does not include the project ID or instance name. */ name?: pulumi.Input; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input; /** * The URI of the created resource. */ selfLink?: pulumi.Input; } /** * 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; /** * 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; /** * The deletion policy for the database. Setting ABANDON allows the resource * to be abandoned rather than deleted. This is useful for Postgres, where databases cannot be * deleted from the API if there are users other than cloudsqlsuperuser with access. Possible * values are: "ABANDON", "DELETE". Defaults to "DELETE". */ deletionPolicy?: pulumi.Input; /** * The name of the Cloud SQL instance. This does not include the project * ID. */ instance: pulumi.Input; /** * The name of the database in the Cloud SQL instance. * This does not include the project ID or instance name. */ name?: pulumi.Input; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input; }