gcp.spanner.Database
Explore with Pulumi AI
A Cloud Spanner Database which is hosted on a Spanner instance.
To get more information about Database, see:
- API documentation
- How-to Guides
Warning: It is strongly recommended to set
lifecycle { prevent_destroy = true }
on databases in order to prevent accidental data loss.
Example Usage
Spanner Database Basic
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var main = new Gcp.Spanner.Instance("main", new()
{
Config = "regional-europe-west1",
DisplayName = "main-instance",
NumNodes = 1,
});
var database = new Gcp.Spanner.Database("database", new()
{
Instance = main.Name,
VersionRetentionPeriod = "3d",
Ddls = new[]
{
"CREATE TABLE t1 (t1 INT64 NOT NULL,) PRIMARY KEY(t1)",
"CREATE TABLE t2 (t2 INT64 NOT NULL,) PRIMARY KEY(t2)",
},
DeletionProtection = false,
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/spanner"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
main, err := spanner.NewInstance(ctx, "main", &spanner.InstanceArgs{
Config: pulumi.String("regional-europe-west1"),
DisplayName: pulumi.String("main-instance"),
NumNodes: pulumi.Int(1),
})
if err != nil {
return err
}
_, err = spanner.NewDatabase(ctx, "database", &spanner.DatabaseArgs{
Instance: main.Name,
VersionRetentionPeriod: pulumi.String("3d"),
Ddls: pulumi.StringArray{
pulumi.String("CREATE TABLE t1 (t1 INT64 NOT NULL,) PRIMARY KEY(t1)"),
pulumi.String("CREATE TABLE t2 (t2 INT64 NOT NULL,) PRIMARY KEY(t2)"),
},
DeletionProtection: pulumi.Bool(false),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.spanner.Instance;
import com.pulumi.gcp.spanner.InstanceArgs;
import com.pulumi.gcp.spanner.Database;
import com.pulumi.gcp.spanner.DatabaseArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var main = new Instance("main", InstanceArgs.builder()
.config("regional-europe-west1")
.displayName("main-instance")
.numNodes(1)
.build());
var database = new Database("database", DatabaseArgs.builder()
.instance(main.name())
.versionRetentionPeriod("3d")
.ddls(
"CREATE TABLE t1 (t1 INT64 NOT NULL,) PRIMARY KEY(t1)",
"CREATE TABLE t2 (t2 INT64 NOT NULL,) PRIMARY KEY(t2)")
.deletionProtection(false)
.build());
}
}
import pulumi
import pulumi_gcp as gcp
main = gcp.spanner.Instance("main",
config="regional-europe-west1",
display_name="main-instance",
num_nodes=1)
database = gcp.spanner.Database("database",
instance=main.name,
version_retention_period="3d",
ddls=[
"CREATE TABLE t1 (t1 INT64 NOT NULL,) PRIMARY KEY(t1)",
"CREATE TABLE t2 (t2 INT64 NOT NULL,) PRIMARY KEY(t2)",
],
deletion_protection=False)
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,
versionRetentionPeriod: "3d",
ddls: [
"CREATE TABLE t1 (t1 INT64 NOT NULL,) PRIMARY KEY(t1)",
"CREATE TABLE t2 (t2 INT64 NOT NULL,) PRIMARY KEY(t2)",
],
deletionProtection: false,
});
resources:
main:
type: gcp:spanner:Instance
properties:
config: regional-europe-west1
displayName: main-instance
numNodes: 1
database:
type: gcp:spanner:Database
properties:
instance: ${main.name}
versionRetentionPeriod: 3d
ddls:
- CREATE TABLE t1 (t1 INT64 NOT NULL,) PRIMARY KEY(t1)
- CREATE TABLE t2 (t2 INT64 NOT NULL,) PRIMARY KEY(t2)
deletionProtection: false
Create Database Resource
new Database(name: string, args: DatabaseArgs, opts?: CustomResourceOptions);
@overload
def Database(resource_name: str,
opts: Optional[ResourceOptions] = None,
database_dialect: Optional[str] = None,
ddls: Optional[Sequence[str]] = None,
deletion_protection: Optional[bool] = None,
enable_drop_protection: Optional[bool] = None,
encryption_config: Optional[DatabaseEncryptionConfigArgs] = None,
instance: Optional[str] = None,
name: Optional[str] = None,
project: Optional[str] = None,
version_retention_period: Optional[str] = None)
@overload
def Database(resource_name: str,
args: DatabaseArgs,
opts: Optional[ResourceOptions] = None)
func NewDatabase(ctx *Context, name string, args DatabaseArgs, opts ...ResourceOption) (*Database, error)
public Database(string name, DatabaseArgs args, CustomResourceOptions? opts = null)
public Database(String name, DatabaseArgs args)
public Database(String name, DatabaseArgs args, CustomResourceOptions options)
type: gcp:spanner:Database
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args DatabaseArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args DatabaseArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args DatabaseArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args DatabaseArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args DatabaseArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Database Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The Database resource accepts the following input properties:
- Instance string
The instance to create the database on.
- Database
Dialect string 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
.- Ddls List<string>
An optional list of DDL statements to run inside the newly created database. Statements can create tables, indexes, etc. These statements execute atomically with the creation of the database: if there is an error in any statement, the database is not created.
- Deletion
Protection bool Whether or not to allow the provider to destroy the instance. Unless this field is set to false in state, a
destroy
orupdate
that would delete the instance will fail.- Enable
Drop boolProtection Whether drop protection is enabled for this database. Defaults to false. Drop protection is different from the "deletion_protection" attribute in the following ways: (1) "deletion_protection" only protects the database from deletions in Terraform. whereas setting “enableDropProtection” to true protects the database from deletions in all interfaces. (2) Setting "enableDropProtection" to true also prevents the deletion of the parent instance containing the database. "deletion_protection" attribute does not provide protection against the deletion of the parent instance.
- Encryption
Config DatabaseEncryption Config Encryption configuration for the database Structure is documented below.
- Name 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].
- Project string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- Version
Retention stringPeriod 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.
- Instance string
The instance to create the database on.
- Database
Dialect string 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
.- Ddls []string
An optional list of DDL statements to run inside the newly created database. Statements can create tables, indexes, etc. These statements execute atomically with the creation of the database: if there is an error in any statement, the database is not created.
- Deletion
Protection bool Whether or not to allow the provider to destroy the instance. Unless this field is set to false in state, a
destroy
orupdate
that would delete the instance will fail.- Enable
Drop boolProtection Whether drop protection is enabled for this database. Defaults to false. Drop protection is different from the "deletion_protection" attribute in the following ways: (1) "deletion_protection" only protects the database from deletions in Terraform. whereas setting “enableDropProtection” to true protects the database from deletions in all interfaces. (2) Setting "enableDropProtection" to true also prevents the deletion of the parent instance containing the database. "deletion_protection" attribute does not provide protection against the deletion of the parent instance.
- Encryption
Config DatabaseEncryption Config Args Encryption configuration for the database Structure is documented below.
- Name 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].
- Project string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- Version
Retention stringPeriod 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.
- instance String
The instance to create the database on.
- database
Dialect String 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
.- ddls List<String>
An optional list of DDL statements to run inside the newly created database. Statements can create tables, indexes, etc. These statements execute atomically with the creation of the database: if there is an error in any statement, the database is not created.
- deletion
Protection Boolean Whether or not to allow the provider to destroy the instance. Unless this field is set to false in state, a
destroy
orupdate
that would delete the instance will fail.- enable
Drop BooleanProtection Whether drop protection is enabled for this database. Defaults to false. Drop protection is different from the "deletion_protection" attribute in the following ways: (1) "deletion_protection" only protects the database from deletions in Terraform. whereas setting “enableDropProtection” to true protects the database from deletions in all interfaces. (2) Setting "enableDropProtection" to true also prevents the deletion of the parent instance containing the database. "deletion_protection" attribute does not provide protection against the deletion of the parent instance.
- encryption
Config DatabaseEncryption Config Encryption configuration for the database Structure is documented below.
- name 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].
- project String
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- version
Retention StringPeriod 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.
- instance string
The instance to create the database on.
- database
Dialect string 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
.- ddls string[]
An optional list of DDL statements to run inside the newly created database. Statements can create tables, indexes, etc. These statements execute atomically with the creation of the database: if there is an error in any statement, the database is not created.
- deletion
Protection boolean Whether or not to allow the provider to destroy the instance. Unless this field is set to false in state, a
destroy
orupdate
that would delete the instance will fail.- enable
Drop booleanProtection Whether drop protection is enabled for this database. Defaults to false. Drop protection is different from the "deletion_protection" attribute in the following ways: (1) "deletion_protection" only protects the database from deletions in Terraform. whereas setting “enableDropProtection” to true protects the database from deletions in all interfaces. (2) Setting "enableDropProtection" to true also prevents the deletion of the parent instance containing the database. "deletion_protection" attribute does not provide protection against the deletion of the parent instance.
- encryption
Config DatabaseEncryption Config Encryption configuration for the database Structure is documented below.
- name 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].
- project string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- version
Retention stringPeriod 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.
- instance str
The instance to create the database on.
- database_
dialect str 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
.- ddls Sequence[str]
An optional list of DDL statements to run inside the newly created database. Statements can create tables, indexes, etc. These statements execute atomically with the creation of the database: if there is an error in any statement, the database is not created.
- deletion_
protection bool Whether or not to allow the provider to destroy the instance. Unless this field is set to false in state, a
destroy
orupdate
that would delete the instance will fail.- enable_
drop_ boolprotection Whether drop protection is enabled for this database. Defaults to false. Drop protection is different from the "deletion_protection" attribute in the following ways: (1) "deletion_protection" only protects the database from deletions in Terraform. whereas setting “enableDropProtection” to true protects the database from deletions in all interfaces. (2) Setting "enableDropProtection" to true also prevents the deletion of the parent instance containing the database. "deletion_protection" attribute does not provide protection against the deletion of the parent instance.
- encryption_
config DatabaseEncryption Config Args Encryption configuration for the database Structure is documented below.
- name str
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].
- project str
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- version_
retention_ strperiod 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.
- instance String
The instance to create the database on.
- database
Dialect String 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
.- ddls List<String>
An optional list of DDL statements to run inside the newly created database. Statements can create tables, indexes, etc. These statements execute atomically with the creation of the database: if there is an error in any statement, the database is not created.
- deletion
Protection Boolean Whether or not to allow the provider to destroy the instance. Unless this field is set to false in state, a
destroy
orupdate
that would delete the instance will fail.- enable
Drop BooleanProtection Whether drop protection is enabled for this database. Defaults to false. Drop protection is different from the "deletion_protection" attribute in the following ways: (1) "deletion_protection" only protects the database from deletions in Terraform. whereas setting “enableDropProtection” to true protects the database from deletions in all interfaces. (2) Setting "enableDropProtection" to true also prevents the deletion of the parent instance containing the database. "deletion_protection" attribute does not provide protection against the deletion of the parent instance.
- encryption
Config Property Map Encryption configuration for the database Structure is documented below.
- name 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].
- project String
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- version
Retention StringPeriod 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.
Outputs
All input properties are implicitly available as output properties. Additionally, the Database resource produces the following output properties:
Look up Existing Database Resource
Get an existing Database resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: DatabaseState, opts?: CustomResourceOptions): Database
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
database_dialect: Optional[str] = None,
ddls: Optional[Sequence[str]] = None,
deletion_protection: Optional[bool] = None,
enable_drop_protection: Optional[bool] = None,
encryption_config: Optional[DatabaseEncryptionConfigArgs] = None,
instance: Optional[str] = None,
name: Optional[str] = None,
project: Optional[str] = None,
state: Optional[str] = None,
version_retention_period: Optional[str] = None) -> Database
func GetDatabase(ctx *Context, name string, id IDInput, state *DatabaseState, opts ...ResourceOption) (*Database, error)
public static Database Get(string name, Input<string> id, DatabaseState? state, CustomResourceOptions? opts = null)
public static Database get(String name, Output<String> id, DatabaseState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Database
Dialect string 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
.- Ddls List<string>
An optional list of DDL statements to run inside the newly created database. Statements can create tables, indexes, etc. These statements execute atomically with the creation of the database: if there is an error in any statement, the database is not created.
- Deletion
Protection bool Whether or not to allow the provider to destroy the instance. Unless this field is set to false in state, a
destroy
orupdate
that would delete the instance will fail.- Enable
Drop boolProtection Whether drop protection is enabled for this database. Defaults to false. Drop protection is different from the "deletion_protection" attribute in the following ways: (1) "deletion_protection" only protects the database from deletions in Terraform. whereas setting “enableDropProtection” to true protects the database from deletions in all interfaces. (2) Setting "enableDropProtection" to true also prevents the deletion of the parent instance containing the database. "deletion_protection" attribute does not provide protection against the deletion of the parent instance.
- Encryption
Config DatabaseEncryption Config Encryption configuration for the database Structure is documented below.
- Instance string
The instance to create the database on.
- Name 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].
- Project string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- State string
An explanation of the status of the database.
- Version
Retention stringPeriod 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.
- Database
Dialect string 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
.- Ddls []string
An optional list of DDL statements to run inside the newly created database. Statements can create tables, indexes, etc. These statements execute atomically with the creation of the database: if there is an error in any statement, the database is not created.
- Deletion
Protection bool Whether or not to allow the provider to destroy the instance. Unless this field is set to false in state, a
destroy
orupdate
that would delete the instance will fail.- Enable
Drop boolProtection Whether drop protection is enabled for this database. Defaults to false. Drop protection is different from the "deletion_protection" attribute in the following ways: (1) "deletion_protection" only protects the database from deletions in Terraform. whereas setting “enableDropProtection” to true protects the database from deletions in all interfaces. (2) Setting "enableDropProtection" to true also prevents the deletion of the parent instance containing the database. "deletion_protection" attribute does not provide protection against the deletion of the parent instance.
- Encryption
Config DatabaseEncryption Config Args Encryption configuration for the database Structure is documented below.
- Instance string
The instance to create the database on.
- Name 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].
- Project string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- State string
An explanation of the status of the database.
- Version
Retention stringPeriod 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.
- database
Dialect String 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
.- ddls List<String>
An optional list of DDL statements to run inside the newly created database. Statements can create tables, indexes, etc. These statements execute atomically with the creation of the database: if there is an error in any statement, the database is not created.
- deletion
Protection Boolean Whether or not to allow the provider to destroy the instance. Unless this field is set to false in state, a
destroy
orupdate
that would delete the instance will fail.- enable
Drop BooleanProtection Whether drop protection is enabled for this database. Defaults to false. Drop protection is different from the "deletion_protection" attribute in the following ways: (1) "deletion_protection" only protects the database from deletions in Terraform. whereas setting “enableDropProtection” to true protects the database from deletions in all interfaces. (2) Setting "enableDropProtection" to true also prevents the deletion of the parent instance containing the database. "deletion_protection" attribute does not provide protection against the deletion of the parent instance.
- encryption
Config DatabaseEncryption Config Encryption configuration for the database Structure is documented below.
- instance String
The instance to create the database on.
- name 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].
- project String
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- state String
An explanation of the status of the database.
- version
Retention StringPeriod 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.
- database
Dialect string 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
.- ddls string[]
An optional list of DDL statements to run inside the newly created database. Statements can create tables, indexes, etc. These statements execute atomically with the creation of the database: if there is an error in any statement, the database is not created.
- deletion
Protection boolean Whether or not to allow the provider to destroy the instance. Unless this field is set to false in state, a
destroy
orupdate
that would delete the instance will fail.- enable
Drop booleanProtection Whether drop protection is enabled for this database. Defaults to false. Drop protection is different from the "deletion_protection" attribute in the following ways: (1) "deletion_protection" only protects the database from deletions in Terraform. whereas setting “enableDropProtection” to true protects the database from deletions in all interfaces. (2) Setting "enableDropProtection" to true also prevents the deletion of the parent instance containing the database. "deletion_protection" attribute does not provide protection against the deletion of the parent instance.
- encryption
Config DatabaseEncryption Config Encryption configuration for the database Structure is documented below.
- instance string
The instance to create the database on.
- name 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].
- project string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- state string
An explanation of the status of the database.
- version
Retention stringPeriod 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.
- database_
dialect str 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
.- ddls Sequence[str]
An optional list of DDL statements to run inside the newly created database. Statements can create tables, indexes, etc. These statements execute atomically with the creation of the database: if there is an error in any statement, the database is not created.
- deletion_
protection bool Whether or not to allow the provider to destroy the instance. Unless this field is set to false in state, a
destroy
orupdate
that would delete the instance will fail.- enable_
drop_ boolprotection Whether drop protection is enabled for this database. Defaults to false. Drop protection is different from the "deletion_protection" attribute in the following ways: (1) "deletion_protection" only protects the database from deletions in Terraform. whereas setting “enableDropProtection” to true protects the database from deletions in all interfaces. (2) Setting "enableDropProtection" to true also prevents the deletion of the parent instance containing the database. "deletion_protection" attribute does not provide protection against the deletion of the parent instance.
- encryption_
config DatabaseEncryption Config Args Encryption configuration for the database Structure is documented below.
- instance str
The instance to create the database on.
- name str
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].
- project str
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- state str
An explanation of the status of the database.
- version_
retention_ strperiod 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.
- database
Dialect String 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
.- ddls List<String>
An optional list of DDL statements to run inside the newly created database. Statements can create tables, indexes, etc. These statements execute atomically with the creation of the database: if there is an error in any statement, the database is not created.
- deletion
Protection Boolean Whether or not to allow the provider to destroy the instance. Unless this field is set to false in state, a
destroy
orupdate
that would delete the instance will fail.- enable
Drop BooleanProtection Whether drop protection is enabled for this database. Defaults to false. Drop protection is different from the "deletion_protection" attribute in the following ways: (1) "deletion_protection" only protects the database from deletions in Terraform. whereas setting “enableDropProtection” to true protects the database from deletions in all interfaces. (2) Setting "enableDropProtection" to true also prevents the deletion of the parent instance containing the database. "deletion_protection" attribute does not provide protection against the deletion of the parent instance.
- encryption
Config Property Map Encryption configuration for the database Structure is documented below.
- instance String
The instance to create the database on.
- name 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].
- project String
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- state String
An explanation of the status of the database.
- version
Retention StringPeriod 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.
Supporting Types
DatabaseEncryptionConfig, DatabaseEncryptionConfigArgs
- Kms
Key stringName Fully qualified name of the KMS key to use to encrypt this database. This key must exist in the same location as the Spanner Database.
- Kms
Key stringName Fully qualified name of the KMS key to use to encrypt this database. This key must exist in the same location as the Spanner Database.
- kms
Key StringName Fully qualified name of the KMS key to use to encrypt this database. This key must exist in the same location as the Spanner Database.
- kms
Key stringName Fully qualified name of the KMS key to use to encrypt this database. This key must exist in the same location as the Spanner Database.
- kms_
key_ strname Fully qualified name of the KMS key to use to encrypt this database. This key must exist in the same location as the Spanner Database.
- kms
Key StringName Fully qualified name of the KMS key to use to encrypt this database. This key must exist in the same location as the Spanner Database.
Import
Database can be imported using any of these accepted formats
$ pulumi import gcp:spanner/database:Database default projects/{{project}}/instances/{{instance}}/databases/{{name}}
$ pulumi import gcp:spanner/database:Database default instances/{{instance}}/databases/{{name}}
$ pulumi import gcp:spanner/database:Database default {{project}}/{{instance}}/{{name}}
$ pulumi import gcp:spanner/database:Database default {{instance}}/{{name}}
Package Details
- Repository
- Google Cloud (GCP) Classic pulumi/pulumi-gcp
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
google-beta
Terraform Provider.