Class Database
A Cloud Spanner Database which is hosted on a Spanner instance.
To get more information about Database, see:
- API documentation
- How-to Guides
- Official Documentation
Example Usage - Spanner Database Basic
using Pulumi;
using Gcp = Pulumi.Gcp;
class MyStack : Stack
{
public MyStack()
{
var main = new Gcp.Spanner.Instance("main", new Gcp.Spanner.InstanceArgs
{
Config = "regional-europe-west1",
DisplayName = "main-instance",
});
var database = new Gcp.Spanner.Database("database", new Gcp.Spanner.DatabaseArgs
{
Instance = main.Name,
Ddls =
{
"CREATE TABLE t1 (t1 INT64 NOT NULL,) PRIMARY KEY(t1)",
"CREATE TABLE t2 (t2 INT64 NOT NULL,) PRIMARY KEY(t2)",
},
});
}
}
Inherited Members
Namespace: Pulumi.Gcp.Spanner
Assembly: Pulumi.Gcp.dll
Syntax
public class Database : CustomResource
Constructors
View SourceDatabase(String, DatabaseArgs, CustomResourceOptions)
Create a Database resource with the given unique name, arguments, and options.
Declaration
public Database(string name, DatabaseArgs args, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| DatabaseArgs | args | The arguments used to populate this resource's properties |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Properties
View SourceDdls
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.
Declaration
public Output<ImmutableArray<string>> Ddls { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableArray<System.String>> |
Instance
The instance to create the database on.
Declaration
public Output<string> Instance { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Name
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].
Declaration
public Output<string> Name { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Project
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
Declaration
public Output<string> Project { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
State
An explanation of the status of the database.
Declaration
public Output<string> State { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Methods
View SourceGet(String, Input<String>, DatabaseState, CustomResourceOptions)
Get an existing Database resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static Database Get(string name, Input<string> id, DatabaseState state = null, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resulting resource. |
| Input<System.String> | id | The unique provider ID of the resource to lookup. |
| DatabaseState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| Database |