Viewing docs for Google Cloud v9.15.0
published on Thursday, Mar 12, 2026 by Pulumi
published on Thursday, Mar 12, 2026 by Pulumi
Viewing docs for Google Cloud v9.15.0
published on Thursday, Mar 12, 2026 by Pulumi
published on Thursday, Mar 12, 2026 by Pulumi
Get a spanner database from Google Cloud by its name and instance name.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const foo = gcp.spanner.getDatabase({
name: "foo",
instance: instance.name,
});
import pulumi
import pulumi_gcp as gcp
foo = gcp.spanner.get_database(name="foo",
instance=instance["name"])
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/spanner"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := spanner.LookupDatabase(ctx, &spanner.LookupDatabaseArgs{
Name: "foo",
Instance: instance.Name,
}, nil)
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var foo = Gcp.Spanner.GetDatabase.Invoke(new()
{
Name = "foo",
Instance = instance.Name,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.spanner.SpannerFunctions;
import com.pulumi.gcp.spanner.inputs.GetDatabaseArgs;
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) {
final var foo = SpannerFunctions.getDatabase(GetDatabaseArgs.builder()
.name("foo")
.instance(instance.name())
.build());
}
}
variables:
foo:
fn::invoke:
function: gcp:spanner:getDatabase
arguments:
name: foo
instance: ${instance.name}
Using getDatabase
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getDatabase(args: GetDatabaseArgs, opts?: InvokeOptions): Promise<GetDatabaseResult>
function getDatabaseOutput(args: GetDatabaseOutputArgs, opts?: InvokeOptions): Output<GetDatabaseResult>def get_database(instance: Optional[str] = None,
name: Optional[str] = None,
project: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetDatabaseResult
def get_database_output(instance: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
project: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetDatabaseResult]func LookupDatabase(ctx *Context, args *LookupDatabaseArgs, opts ...InvokeOption) (*LookupDatabaseResult, error)
func LookupDatabaseOutput(ctx *Context, args *LookupDatabaseOutputArgs, opts ...InvokeOption) LookupDatabaseResultOutput> Note: This function is named LookupDatabase in the Go SDK.
public static class GetDatabase
{
public static Task<GetDatabaseResult> InvokeAsync(GetDatabaseArgs args, InvokeOptions? opts = null)
public static Output<GetDatabaseResult> Invoke(GetDatabaseInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetDatabaseResult> getDatabase(GetDatabaseArgs args, InvokeOptions options)
public static Output<GetDatabaseResult> getDatabase(GetDatabaseArgs args, InvokeOptions options)
fn::invoke:
function: gcp:spanner/getDatabase:getDatabase
arguments:
# arguments dictionaryThe following arguments are supported:
getDatabase Result
The following output properties are available:
- Database
Dialect string - Ddls List<string>
- Default
Time stringZone - Deletion
Protection bool - Enable
Drop boolProtection - Encryption
Configs List<GetDatabase Encryption Config> - Id string
- The provider-assigned unique ID for this managed resource.
- Instance string
- Name string
- State string
- Version
Retention stringPeriod - Project string
- Database
Dialect string - Ddls []string
- Default
Time stringZone - Deletion
Protection bool - Enable
Drop boolProtection - Encryption
Configs []GetDatabase Encryption Config - Id string
- The provider-assigned unique ID for this managed resource.
- Instance string
- Name string
- State string
- Version
Retention stringPeriod - Project string
- database
Dialect String - ddls List<String>
- default
Time StringZone - deletion
Protection Boolean - enable
Drop BooleanProtection - encryption
Configs List<GetDatabase Encryption Config> - id String
- The provider-assigned unique ID for this managed resource.
- instance String
- name String
- state String
- version
Retention StringPeriod - project String
- database
Dialect string - ddls string[]
- default
Time stringZone - deletion
Protection boolean - enable
Drop booleanProtection - encryption
Configs GetDatabase Encryption Config[] - id string
- The provider-assigned unique ID for this managed resource.
- instance string
- name string
- state string
- version
Retention stringPeriod - project string
- database_
dialect str - ddls Sequence[str]
- default_
time_ strzone - deletion_
protection bool - enable_
drop_ boolprotection - encryption_
configs Sequence[GetDatabase Encryption Config] - id str
- The provider-assigned unique ID for this managed resource.
- instance str
- name str
- state str
- version_
retention_ strperiod - project str
- database
Dialect String - ddls List<String>
- default
Time StringZone - deletion
Protection Boolean - enable
Drop BooleanProtection - encryption
Configs List<Property Map> - id String
- The provider-assigned unique ID for this managed resource.
- instance String
- name String
- state String
- version
Retention StringPeriod - project String
Supporting Types
GetDatabaseEncryptionConfig
- 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 List<string>Names - Fully qualified name of the KMS keys to use to encrypt this database. The keys must exist in the same locations 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 []stringNames - Fully qualified name of the KMS keys to use to encrypt this database. The keys must exist in the same locations 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 List<String>Names - Fully qualified name of the KMS keys to use to encrypt this database. The keys must exist in the same locations 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 string[]Names - Fully qualified name of the KMS keys to use to encrypt this database. The keys must exist in the same locations 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_ Sequence[str]names - Fully qualified name of the KMS keys to use to encrypt this database. The keys must exist in the same locations 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 List<String>Names - Fully qualified name of the KMS keys to use to encrypt this database. The keys must exist in the same locations as the Spanner Database.
Package Details
- Repository
- Google Cloud (GCP) Classic pulumi/pulumi-gcp
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
google-betaTerraform Provider.
Viewing docs for Google Cloud v9.15.0
published on Thursday, Mar 12, 2026 by Pulumi
published on Thursday, Mar 12, 2026 by Pulumi
