Google Cloud (GCP) Classic

Pulumi Official
Package maintained by Pulumi
v6.32.0 published on Wednesday, Jul 20, 2022 by Pulumi

getDatabaseInstance

Use this data source to get information about a Cloud SQL instance.

Example Usage

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
    public MyStack()
    {
        var qa = Output.Create(Gcp.Sql.GetDatabaseInstance.InvokeAsync(new Gcp.Sql.GetDatabaseInstanceArgs
        {
            Name = "test-sql-instance",
        }));
    }

}
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/sql"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := sql.LookupDatabaseInstance(ctx, &sql.LookupDatabaseInstanceArgs{
			Name: "test-sql-instance",
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var qa = Output.of(SqlFunctions.getDatabaseInstance(GetDatabaseInstanceArgs.builder()
            .name("test-sql-instance")
            .build()));

    }
}
import pulumi
import pulumi_gcp as gcp

qa = gcp.sql.get_database_instance(name="test-sql-instance")
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const qa = pulumi.output(gcp.sql.getDatabaseInstance({
    name: "test-sql-instance",
}));
variables:
  qa:
    Fn::Invoke:
      Function: gcp:sql:getDatabaseInstance
      Arguments:
        name: test-sql-instance

Using getDatabaseInstance

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 getDatabaseInstance(args: GetDatabaseInstanceArgs, opts?: InvokeOptions): Promise<GetDatabaseInstanceResult>
function getDatabaseInstanceOutput(args: GetDatabaseInstanceOutputArgs, opts?: InvokeOptions): Output<GetDatabaseInstanceResult>
def get_database_instance(name: Optional[str] = None,
                          project: Optional[str] = None,
                          opts: Optional[InvokeOptions] = None) -> GetDatabaseInstanceResult
def get_database_instance_output(name: Optional[pulumi.Input[str]] = None,
                          project: Optional[pulumi.Input[str]] = None,
                          opts: Optional[InvokeOptions] = None) -> Output[GetDatabaseInstanceResult]
func LookupDatabaseInstance(ctx *Context, args *LookupDatabaseInstanceArgs, opts ...InvokeOption) (*LookupDatabaseInstanceResult, error)
func LookupDatabaseInstanceOutput(ctx *Context, args *LookupDatabaseInstanceOutputArgs, opts ...InvokeOption) LookupDatabaseInstanceResultOutput

> Note: This function is named LookupDatabaseInstance in the Go SDK.

public static class GetDatabaseInstance 
{
    public static Task<GetDatabaseInstanceResult> InvokeAsync(GetDatabaseInstanceArgs args, InvokeOptions? opts = null)
    public static Output<GetDatabaseInstanceResult> Invoke(GetDatabaseInstanceInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetDatabaseInstanceResult> getDatabaseInstance(GetDatabaseInstanceArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: gcp:sql/getDatabaseInstance:getDatabaseInstance
  Arguments:
    # Arguments dictionary

The following arguments are supported:

Name string

The name of the instance.

Project string

The ID of the project in which the resource belongs.

Name string

The name of the instance.

Project string

The ID of the project in which the resource belongs.

name String

The name of the instance.

project String

The ID of the project in which the resource belongs.

name string

The name of the instance.

project string

The ID of the project in which the resource belongs.

name str

The name of the instance.

project str

The ID of the project in which the resource belongs.

name String

The name of the instance.

project String

The ID of the project in which the resource belongs.

getDatabaseInstance Result

The following output properties are available:

Supporting Types

GetDatabaseInstanceClone

GetDatabaseInstanceIpAddress

IpAddress string
TimeToRetire string
Type string
IpAddress string
TimeToRetire string
Type string
ipAddress String
timeToRetire String
type String
ipAddress string
timeToRetire string
type string
ipAddress String
timeToRetire String
type String

GetDatabaseInstanceReplicaConfiguration

GetDatabaseInstanceRestoreBackupContext

BackupRunId int
InstanceId string
Project string

The ID of the project in which the resource belongs.

BackupRunId int
InstanceId string
Project string

The ID of the project in which the resource belongs.

backupRunId Integer
instanceId String
project String

The ID of the project in which the resource belongs.

backupRunId number
instanceId string
project string

The ID of the project in which the resource belongs.

backup_run_id int
instance_id str
project str

The ID of the project in which the resource belongs.

backupRunId Number
instanceId String
project String

The ID of the project in which the resource belongs.

GetDatabaseInstanceServerCaCert

GetDatabaseInstanceSetting

GetDatabaseInstanceSettingActiveDirectoryConfig

Domain string
Domain string
domain String
domain string
domain str
domain String

GetDatabaseInstanceSettingBackupConfiguration

GetDatabaseInstanceSettingBackupConfigurationBackupRetentionSetting

GetDatabaseInstanceSettingDatabaseFlag

Name string

The name of the instance.

Value string
Name string

The name of the instance.

Value string
name String

The name of the instance.

value String
name string

The name of the instance.

value string
name str

The name of the instance.

value str
name String

The name of the instance.

value String

GetDatabaseInstanceSettingInsightsConfig

GetDatabaseInstanceSettingIpConfiguration

GetDatabaseInstanceSettingIpConfigurationAuthorizedNetwork

ExpirationTime string
Name string

The name of the instance.

Value string
ExpirationTime string
Name string

The name of the instance.

Value string
expirationTime String
name String

The name of the instance.

value String
expirationTime string
name string

The name of the instance.

value string
expiration_time str
name str

The name of the instance.

value str
expirationTime String
name String

The name of the instance.

value String

GetDatabaseInstanceSettingLocationPreference

GetDatabaseInstanceSettingMaintenanceWindow

Day int
Hour int
UpdateTrack string
Day int
Hour int
UpdateTrack string
day Integer
hour Integer
updateTrack String
day number
hour number
updateTrack string
day Number
hour Number
updateTrack String

GetDatabaseInstanceSettingSqlServerAuditConfig

Package Details

Repository
https://github.com/pulumi/pulumi-gcp
License
Apache-2.0
Notes

This Pulumi package is based on the google-beta Terraform Provider.