UNPKG

@pulumi/gcp

Version:

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

469 lines (468 loc) • 20.4 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * A Cloud Firestore Database. * * If you wish to use Firestore with App Engine, use the * `gcp.appengine.Application` * resource instead. If you were previously using the `gcp.appengine.Application` resource exclusively for managing a Firestore database * and would like to use the `gcp.firestore.Database` resource instead, please follow the instructions * [here](https://cloud.google.com/firestore/docs/app-engine-requirement). * * To get more information about Database, see: * * * [API documentation](https://cloud.google.com/firestore/docs/reference/rest/v1/projects.databases) * * How-to Guides * * [Official Documentation](https://cloud.google.com/firestore/docs/) * * ## Example Usage * * ### Firestore Default Database * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const database = new gcp.firestore.Database("database", { * project: "my-project-name", * name: "(default)", * locationId: "nam5", * type: "FIRESTORE_NATIVE", * }); * ``` * ### Firestore Database * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const database = new gcp.firestore.Database("database", { * project: "my-project-name", * name: "database-id", * locationId: "nam5", * type: "FIRESTORE_NATIVE", * concurrencyMode: "OPTIMISTIC", * appEngineIntegrationMode: "DISABLED", * pointInTimeRecoveryEnablement: "POINT_IN_TIME_RECOVERY_ENABLED", * deleteProtectionState: "DELETE_PROTECTION_ENABLED", * deletionPolicy: "DELETE", * }); * ``` * ### Firestore Cmek Database * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const project = gcp.organizations.getProject({}); * const keyRing = new gcp.kms.KeyRing("key_ring", { * name: "kms-key-ring", * location: "us", * }); * const cryptoKey = new gcp.kms.CryptoKey("crypto_key", { * name: "kms-key", * keyRing: keyRing.id, * purpose: "ENCRYPT_DECRYPT", * }); * const firestoreCmekKeyuser = new gcp.kms.CryptoKeyIAMBinding("firestore_cmek_keyuser", { * cryptoKeyId: cryptoKey.id, * role: "roles/cloudkms.cryptoKeyEncrypterDecrypter", * members: [project.then(project => `serviceAccount:service-${project.number}@gcp-sa-firestore.iam.gserviceaccount.com`)], * }); * const database = new gcp.firestore.Database("database", { * project: "my-project-name", * name: "cmek-database-id", * locationId: "nam5", * type: "FIRESTORE_NATIVE", * concurrencyMode: "OPTIMISTIC", * appEngineIntegrationMode: "DISABLED", * pointInTimeRecoveryEnablement: "POINT_IN_TIME_RECOVERY_ENABLED", * deleteProtectionState: "DELETE_PROTECTION_ENABLED", * deletionPolicy: "DELETE", * cmekConfig: { * kmsKeyName: cryptoKey.id, * }, * }, { * dependsOn: [firestoreCmekKeyuser], * }); * ``` * ### Firestore Default Database In Datastore Mode * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const datastoreModeDatabase = new gcp.firestore.Database("datastore_mode_database", { * project: "my-project-name", * name: "(default)", * locationId: "nam5", * type: "DATASTORE_MODE", * }); * ``` * ### Firestore Database In Datastore Mode * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const datastoreModeDatabase = new gcp.firestore.Database("datastore_mode_database", { * project: "my-project-name", * name: "database-id", * locationId: "nam5", * type: "DATASTORE_MODE", * concurrencyMode: "OPTIMISTIC", * appEngineIntegrationMode: "DISABLED", * pointInTimeRecoveryEnablement: "POINT_IN_TIME_RECOVERY_ENABLED", * deleteProtectionState: "DELETE_PROTECTION_ENABLED", * deletionPolicy: "DELETE", * }); * ``` * ### Firestore Cmek Database In Datastore Mode * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const project = gcp.organizations.getProject({}); * const keyRing = new gcp.kms.KeyRing("key_ring", { * name: "kms-key-ring", * location: "us", * }); * const cryptoKey = new gcp.kms.CryptoKey("crypto_key", { * name: "kms-key", * keyRing: keyRing.id, * purpose: "ENCRYPT_DECRYPT", * }); * const firestoreCmekKeyuser = new gcp.kms.CryptoKeyIAMBinding("firestore_cmek_keyuser", { * cryptoKeyId: cryptoKey.id, * role: "roles/cloudkms.cryptoKeyEncrypterDecrypter", * members: [project.then(project => `serviceAccount:service-${project.number}@gcp-sa-firestore.iam.gserviceaccount.com`)], * }); * const database = new gcp.firestore.Database("database", { * project: "my-project-name", * name: "cmek-database-id", * locationId: "nam5", * type: "DATASTORE_MODE", * concurrencyMode: "OPTIMISTIC", * appEngineIntegrationMode: "DISABLED", * pointInTimeRecoveryEnablement: "POINT_IN_TIME_RECOVERY_ENABLED", * deleteProtectionState: "DELETE_PROTECTION_ENABLED", * deletionPolicy: "DELETE", * cmekConfig: { * kmsKeyName: cryptoKey.id, * }, * }, { * dependsOn: [firestoreCmekKeyuser], * }); * ``` * * ## Import * * Database can be imported using any of these accepted formats: * * * `projects/{{project}}/databases/{{name}}` * * * `{{project}}/{{name}}` * * * `{{name}}` * * When using the `pulumi import` command, Database can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:firestore/database:Database default projects/{{project}}/databases/{{name}} * ``` * * ```sh * $ pulumi import gcp:firestore/database:Database default {{project}}/{{name}} * ``` * * ```sh * $ pulumi import gcp:firestore/database:Database default {{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 App Engine integration mode to use for this database. * Possible values are: `ENABLED`, `DISABLED`. */ readonly appEngineIntegrationMode: pulumi.Output<string>; /** * The CMEK (Customer Managed Encryption Key) configuration for a Firestore * database. If not present, the database is secured by the default Google * encryption key. * Structure is documented below. */ readonly cmekConfig: pulumi.Output<outputs.firestore.DatabaseCmekConfig | undefined>; /** * The concurrency control mode to use for this database. * Possible values are: `OPTIMISTIC`, `PESSIMISTIC`, `OPTIMISTIC_WITH_ENTITY_GROUPS`. */ readonly concurrencyMode: pulumi.Output<string>; /** * Output only. The timestamp at which this database was created. */ readonly createTime: pulumi.Output<string>; readonly deleteProtectionState: pulumi.Output<string>; readonly deletionPolicy: pulumi.Output<string | undefined>; /** * Output only. The earliest timestamp at which older versions of the data can be read from the database. See versionRetentionPeriod above; this field is populated with now - versionRetentionPeriod. * This value is continuously updated, and becomes stale the moment it is queried. If you are using this value to recover data, make sure to account for the time from the moment when the value is queried to the moment when you initiate the recovery. * A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z". */ readonly earliestVersionTime: pulumi.Output<string>; /** * Output only. This checksum is computed by the server based on the value of other fields, * and may be sent on update and delete requests to ensure the client has an * up-to-date value before proceeding. */ readonly etag: pulumi.Output<string>; /** * Output only. The keyPrefix for this database. * This keyPrefix is used, in combination with the project id ("~") to construct the application id * that is returned from the Cloud Datastore APIs in Google App Engine first generation runtimes. * This value may be empty in which case the appid to use for URL-encoded keys is the projectId (eg: foo instead of v~foo). */ readonly keyPrefix: pulumi.Output<string>; /** * The location of the database. Available locations are listed at * https://cloud.google.com/firestore/docs/locations. */ readonly locationId: pulumi.Output<string>; /** * The ID to use for the database, which will become the final * component of the database's resource name. This value should be 4-63 * characters. Valid characters are /[a-z][0-9]-/ with first character * a letter and the last a letter or a number. Must not be * UUID-like /[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}/. * "(default)" database id is also valid. */ readonly name: pulumi.Output<string>; /** * Whether to enable the PITR feature on this database. * If `POINT_IN_TIME_RECOVERY_ENABLED` is selected, reads are supported on selected versions of the data from within the past 7 days. * versionRetentionPeriod and earliestVersionTime can be used to determine the supported versions. These include reads against any timestamp within the past hour * and reads against 1-minute snapshots beyond 1 hour and within 7 days. * If `POINT_IN_TIME_RECOVERY_DISABLED` is selected, reads are supported on any version of the data from within the past 1 hour. * Default value is `POINT_IN_TIME_RECOVERY_DISABLED`. * Possible values are: `POINT_IN_TIME_RECOVERY_ENABLED`, `POINT_IN_TIME_RECOVERY_DISABLED`. */ readonly pointInTimeRecoveryEnablement: pulumi.Output<string | undefined>; /** * 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 type of the database. * See https://cloud.google.com/datastore/docs/firestore-or-datastore * for information about how to choose. * Possible values are: `FIRESTORE_NATIVE`, `DATASTORE_MODE`. * * * - - - */ readonly type: pulumi.Output<string>; /** * Output only. The system-generated UUID4 for this Database. */ readonly uid: pulumi.Output<string>; /** * Output only. The timestamp at which this database was most recently updated. */ readonly updateTime: pulumi.Output<string>; /** * Output only. The period during which past versions of data are retained in the database. * Any read or query can specify a readTime within this window, and will read the state of the database at that time. * If the PITR feature is enabled, the retention period is 7 days. Otherwise, the retention period is 1 hour. * A duration in seconds with up to nine fractional digits, ending with 's'. Example: "3.5s". */ 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 App Engine integration mode to use for this database. * Possible values are: `ENABLED`, `DISABLED`. */ appEngineIntegrationMode?: pulumi.Input<string>; /** * The CMEK (Customer Managed Encryption Key) configuration for a Firestore * database. If not present, the database is secured by the default Google * encryption key. * Structure is documented below. */ cmekConfig?: pulumi.Input<inputs.firestore.DatabaseCmekConfig>; /** * The concurrency control mode to use for this database. * Possible values are: `OPTIMISTIC`, `PESSIMISTIC`, `OPTIMISTIC_WITH_ENTITY_GROUPS`. */ concurrencyMode?: pulumi.Input<string>; /** * Output only. The timestamp at which this database was created. */ createTime?: pulumi.Input<string>; deleteProtectionState?: pulumi.Input<string>; deletionPolicy?: pulumi.Input<string>; /** * Output only. The earliest timestamp at which older versions of the data can be read from the database. See versionRetentionPeriod above; this field is populated with now - versionRetentionPeriod. * This value is continuously updated, and becomes stale the moment it is queried. If you are using this value to recover data, make sure to account for the time from the moment when the value is queried to the moment when you initiate the recovery. * A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z". */ earliestVersionTime?: pulumi.Input<string>; /** * Output only. This checksum is computed by the server based on the value of other fields, * and may be sent on update and delete requests to ensure the client has an * up-to-date value before proceeding. */ etag?: pulumi.Input<string>; /** * Output only. The keyPrefix for this database. * This keyPrefix is used, in combination with the project id ("~") to construct the application id * that is returned from the Cloud Datastore APIs in Google App Engine first generation runtimes. * This value may be empty in which case the appid to use for URL-encoded keys is the projectId (eg: foo instead of v~foo). */ keyPrefix?: pulumi.Input<string>; /** * The location of the database. Available locations are listed at * https://cloud.google.com/firestore/docs/locations. */ locationId?: pulumi.Input<string>; /** * The ID to use for the database, which will become the final * component of the database's resource name. This value should be 4-63 * characters. Valid characters are /[a-z][0-9]-/ with first character * a letter and the last a letter or a number. Must not be * UUID-like /[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}/. * "(default)" database id is also valid. */ name?: pulumi.Input<string>; /** * Whether to enable the PITR feature on this database. * If `POINT_IN_TIME_RECOVERY_ENABLED` is selected, reads are supported on selected versions of the data from within the past 7 days. * versionRetentionPeriod and earliestVersionTime can be used to determine the supported versions. These include reads against any timestamp within the past hour * and reads against 1-minute snapshots beyond 1 hour and within 7 days. * If `POINT_IN_TIME_RECOVERY_DISABLED` is selected, reads are supported on any version of the data from within the past 1 hour. * Default value is `POINT_IN_TIME_RECOVERY_DISABLED`. * Possible values are: `POINT_IN_TIME_RECOVERY_ENABLED`, `POINT_IN_TIME_RECOVERY_DISABLED`. */ pointInTimeRecoveryEnablement?: 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 type of the database. * See https://cloud.google.com/datastore/docs/firestore-or-datastore * for information about how to choose. * Possible values are: `FIRESTORE_NATIVE`, `DATASTORE_MODE`. * * * - - - */ type?: pulumi.Input<string>; /** * Output only. The system-generated UUID4 for this Database. */ uid?: pulumi.Input<string>; /** * Output only. The timestamp at which this database was most recently updated. */ updateTime?: pulumi.Input<string>; /** * Output only. The period during which past versions of data are retained in the database. * Any read or query can specify a readTime within this window, and will read the state of the database at that time. * If the PITR feature is enabled, the retention period is 7 days. Otherwise, the retention period is 1 hour. * A duration in seconds with up to nine fractional digits, ending with 's'. Example: "3.5s". */ versionRetentionPeriod?: pulumi.Input<string>; } /** * The set of arguments for constructing a Database resource. */ export interface DatabaseArgs { /** * The App Engine integration mode to use for this database. * Possible values are: `ENABLED`, `DISABLED`. */ appEngineIntegrationMode?: pulumi.Input<string>; /** * The CMEK (Customer Managed Encryption Key) configuration for a Firestore * database. If not present, the database is secured by the default Google * encryption key. * Structure is documented below. */ cmekConfig?: pulumi.Input<inputs.firestore.DatabaseCmekConfig>; /** * The concurrency control mode to use for this database. * Possible values are: `OPTIMISTIC`, `PESSIMISTIC`, `OPTIMISTIC_WITH_ENTITY_GROUPS`. */ concurrencyMode?: pulumi.Input<string>; deleteProtectionState?: pulumi.Input<string>; deletionPolicy?: pulumi.Input<string>; /** * The location of the database. Available locations are listed at * https://cloud.google.com/firestore/docs/locations. */ locationId: pulumi.Input<string>; /** * The ID to use for the database, which will become the final * component of the database's resource name. This value should be 4-63 * characters. Valid characters are /[a-z][0-9]-/ with first character * a letter and the last a letter or a number. Must not be * UUID-like /[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}/. * "(default)" database id is also valid. */ name?: pulumi.Input<string>; /** * Whether to enable the PITR feature on this database. * If `POINT_IN_TIME_RECOVERY_ENABLED` is selected, reads are supported on selected versions of the data from within the past 7 days. * versionRetentionPeriod and earliestVersionTime can be used to determine the supported versions. These include reads against any timestamp within the past hour * and reads against 1-minute snapshots beyond 1 hour and within 7 days. * If `POINT_IN_TIME_RECOVERY_DISABLED` is selected, reads are supported on any version of the data from within the past 1 hour. * Default value is `POINT_IN_TIME_RECOVERY_DISABLED`. * Possible values are: `POINT_IN_TIME_RECOVERY_ENABLED`, `POINT_IN_TIME_RECOVERY_DISABLED`. */ pointInTimeRecoveryEnablement?: 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 type of the database. * See https://cloud.google.com/datastore/docs/firestore-or-datastore * for information about how to choose. * Possible values are: `FIRESTORE_NATIVE`, `DATASTORE_MODE`. * * * - - - */ type: pulumi.Input<string>; }