getDatabaseInstance

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

Example Usage

using System.Collections.Generic;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var qa = Gcp.Sql.GetDatabaseInstance.Invoke(new()
    {
        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 com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.sql.SqlFunctions;
import com.pulumi.gcp.sql.inputs.GetDatabaseInstanceArgs;
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 qa = 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

ActivationPolicy string
ActiveDirectoryConfigs List<GetDatabaseInstanceSettingActiveDirectoryConfig>
AvailabilityType string
BackupConfigurations List<GetDatabaseInstanceSettingBackupConfiguration>
Collation string
ConnectorEnforcement string
DatabaseFlags List<GetDatabaseInstanceSettingDatabaseFlag>
DiskAutoresize bool
DiskAutoresizeLimit int
DiskSize int
DiskType string
InsightsConfigs List<GetDatabaseInstanceSettingInsightsConfig>
IpConfigurations List<GetDatabaseInstanceSettingIpConfiguration>
LocationPreferences List<GetDatabaseInstanceSettingLocationPreference>
MaintenanceWindows List<GetDatabaseInstanceSettingMaintenanceWindow>
PasswordValidationPolicies List<GetDatabaseInstanceSettingPasswordValidationPolicy>
PricingPlan string
SqlServerAuditConfigs List<GetDatabaseInstanceSettingSqlServerAuditConfig>
Tier string
TimeZone string
UserLabels Dictionary<string, string>
Version int
ActivationPolicy string
ActiveDirectoryConfigs []GetDatabaseInstanceSettingActiveDirectoryConfig
AvailabilityType string
BackupConfigurations []GetDatabaseInstanceSettingBackupConfiguration
Collation string
ConnectorEnforcement string
DatabaseFlags []GetDatabaseInstanceSettingDatabaseFlag
DiskAutoresize bool
DiskAutoresizeLimit int
DiskSize int
DiskType string
InsightsConfigs []GetDatabaseInstanceSettingInsightsConfig
IpConfigurations []GetDatabaseInstanceSettingIpConfiguration
LocationPreferences []GetDatabaseInstanceSettingLocationPreference
MaintenanceWindows []GetDatabaseInstanceSettingMaintenanceWindow
PasswordValidationPolicies []GetDatabaseInstanceSettingPasswordValidationPolicy
PricingPlan string
SqlServerAuditConfigs []GetDatabaseInstanceSettingSqlServerAuditConfig
Tier string
TimeZone string
UserLabels map[string]string
Version int
activationPolicy String
activeDirectoryConfigs List<GetDatabaseInstanceSettingActiveDirectoryConfig>
availabilityType String
backupConfigurations List<GetDatabaseInstanceSettingBackupConfiguration>
collation String
connectorEnforcement String
databaseFlags List<GetDatabaseInstanceSettingDatabaseFlag>
diskAutoresize Boolean
diskAutoresizeLimit Integer
diskSize Integer
diskType String
insightsConfigs List<GetDatabaseInstanceSettingInsightsConfig>
ipConfigurations List<GetDatabaseInstanceSettingIpConfiguration>
locationPreferences List<GetDatabaseInstanceSettingLocationPreference>
maintenanceWindows List<GetDatabaseInstanceSettingMaintenanceWindow>
passwordValidationPolicies List<GetDatabaseInstanceSettingPasswordValidationPolicy>
pricingPlan String
sqlServerAuditConfigs List<GetDatabaseInstanceSettingSqlServerAuditConfig>
tier String
timeZone String
userLabels Map<String,String>
version Integer
activationPolicy string
activeDirectoryConfigs GetDatabaseInstanceSettingActiveDirectoryConfig[]
availabilityType string
backupConfigurations GetDatabaseInstanceSettingBackupConfiguration[]
collation string
connectorEnforcement string
databaseFlags GetDatabaseInstanceSettingDatabaseFlag[]
diskAutoresize boolean
diskAutoresizeLimit number
diskSize number
diskType string
insightsConfigs GetDatabaseInstanceSettingInsightsConfig[]
ipConfigurations GetDatabaseInstanceSettingIpConfiguration[]
locationPreferences GetDatabaseInstanceSettingLocationPreference[]
maintenanceWindows GetDatabaseInstanceSettingMaintenanceWindow[]
passwordValidationPolicies GetDatabaseInstanceSettingPasswordValidationPolicy[]
pricingPlan string
sqlServerAuditConfigs GetDatabaseInstanceSettingSqlServerAuditConfig[]
tier string
timeZone string
userLabels {[key: string]: string}
version number
activation_policy str
active_directory_configs Sequence[GetDatabaseInstanceSettingActiveDirectoryConfig]
availability_type str
backup_configurations Sequence[GetDatabaseInstanceSettingBackupConfiguration]
collation str
connector_enforcement str
database_flags Sequence[GetDatabaseInstanceSettingDatabaseFlag]
disk_autoresize bool
disk_autoresize_limit int
disk_size int
disk_type str
insights_configs Sequence[GetDatabaseInstanceSettingInsightsConfig]
ip_configurations Sequence[GetDatabaseInstanceSettingIpConfiguration]
location_preferences Sequence[GetDatabaseInstanceSettingLocationPreference]
maintenance_windows Sequence[GetDatabaseInstanceSettingMaintenanceWindow]
password_validation_policies Sequence[GetDatabaseInstanceSettingPasswordValidationPolicy]
pricing_plan str
sql_server_audit_configs Sequence[GetDatabaseInstanceSettingSqlServerAuditConfig]
tier str
time_zone str
user_labels Mapping[str, str]
version int

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

GetDatabaseInstanceSettingPasswordValidationPolicy

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.