1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. spanner
  5. getInstance
Google Cloud v8.27.0 published on Thursday, Apr 17, 2025 by Pulumi

gcp.spanner.getInstance

Explore with Pulumi AI

Google Cloud v8.27.0 published on Thursday, Apr 17, 2025 by Pulumi

Get a spanner instance from Google Cloud by its name.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const foo = gcp.spanner.getInstance({
    name: "bar",
});
Copy
import pulumi
import pulumi_gcp as gcp

foo = gcp.spanner.get_instance(name="bar")
Copy
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/spanner"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := spanner.LookupInstance(ctx, &spanner.LookupInstanceArgs{
			Name: "bar",
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var foo = Gcp.Spanner.GetInstance.Invoke(new()
    {
        Name = "bar",
    });

});
Copy
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.GetInstanceArgs;
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.getInstance(GetInstanceArgs.builder()
            .name("bar")
            .build());

    }
}
Copy
variables:
  foo:
    fn::invoke:
      function: gcp:spanner:getInstance
      arguments:
        name: bar
Copy

Using getInstance

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 getInstance(args: GetInstanceArgs, opts?: InvokeOptions): Promise<GetInstanceResult>
function getInstanceOutput(args: GetInstanceOutputArgs, opts?: InvokeOptions): Output<GetInstanceResult>
Copy
def get_instance(config: Optional[str] = None,
                 display_name: Optional[str] = None,
                 name: Optional[str] = None,
                 project: Optional[str] = None,
                 opts: Optional[InvokeOptions] = None) -> GetInstanceResult
def get_instance_output(config: Optional[pulumi.Input[str]] = None,
                 display_name: Optional[pulumi.Input[str]] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 project: Optional[pulumi.Input[str]] = None,
                 opts: Optional[InvokeOptions] = None) -> Output[GetInstanceResult]
Copy
func LookupInstance(ctx *Context, args *LookupInstanceArgs, opts ...InvokeOption) (*LookupInstanceResult, error)
func LookupInstanceOutput(ctx *Context, args *LookupInstanceOutputArgs, opts ...InvokeOption) LookupInstanceResultOutput
Copy

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

public static class GetInstance 
{
    public static Task<GetInstanceResult> InvokeAsync(GetInstanceArgs args, InvokeOptions? opts = null)
    public static Output<GetInstanceResult> Invoke(GetInstanceInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetInstanceResult> getInstance(GetInstanceArgs args, InvokeOptions options)
public static Output<GetInstanceResult> getInstance(GetInstanceArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: gcp:spanner/getInstance:getInstance
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Name This property is required. string
The name of the spanner instance.


Config string
DisplayName string
Project string
The project in which the resource belongs. If it is not provided, the provider project is used.
Name This property is required. string
The name of the spanner instance.


Config string
DisplayName string
Project string
The project in which the resource belongs. If it is not provided, the provider project is used.
name This property is required. String
The name of the spanner instance.


config String
displayName String
project String
The project in which the resource belongs. If it is not provided, the provider project is used.
name This property is required. string
The name of the spanner instance.


config string
displayName string
project string
The project in which the resource belongs. If it is not provided, the provider project is used.
name This property is required. str
The name of the spanner instance.


config str
display_name str
project str
The project in which the resource belongs. If it is not provided, the provider project is used.
name This property is required. String
The name of the spanner instance.


config String
displayName String
project String
The project in which the resource belongs. If it is not provided, the provider project is used.

getInstance Result

The following output properties are available:

AutoscalingConfigs List<GetInstanceAutoscalingConfig>
DefaultBackupScheduleType string
Edition string
EffectiveLabels Dictionary<string, string>
ForceDestroy bool
Id string
The provider-assigned unique ID for this managed resource.
Labels Dictionary<string, string>
Name string
NumNodes int
ProcessingUnits int
PulumiLabels Dictionary<string, string>
State string
Config string
DisplayName string
Project string
AutoscalingConfigs []GetInstanceAutoscalingConfig
DefaultBackupScheduleType string
Edition string
EffectiveLabels map[string]string
ForceDestroy bool
Id string
The provider-assigned unique ID for this managed resource.
Labels map[string]string
Name string
NumNodes int
ProcessingUnits int
PulumiLabels map[string]string
State string
Config string
DisplayName string
Project string
autoscalingConfigs List<GetInstanceAutoscalingConfig>
defaultBackupScheduleType String
edition String
effectiveLabels Map<String,String>
forceDestroy Boolean
id String
The provider-assigned unique ID for this managed resource.
labels Map<String,String>
name String
numNodes Integer
processingUnits Integer
pulumiLabels Map<String,String>
state String
config String
displayName String
project String
autoscalingConfigs GetInstanceAutoscalingConfig[]
defaultBackupScheduleType string
edition string
effectiveLabels {[key: string]: string}
forceDestroy boolean
id string
The provider-assigned unique ID for this managed resource.
labels {[key: string]: string}
name string
numNodes number
processingUnits number
pulumiLabels {[key: string]: string}
state string
config string
displayName string
project string
autoscaling_configs Sequence[GetInstanceAutoscalingConfig]
default_backup_schedule_type str
edition str
effective_labels Mapping[str, str]
force_destroy bool
id str
The provider-assigned unique ID for this managed resource.
labels Mapping[str, str]
name str
num_nodes int
processing_units int
pulumi_labels Mapping[str, str]
state str
config str
display_name str
project str
autoscalingConfigs List<Property Map>
defaultBackupScheduleType String
edition String
effectiveLabels Map<String>
forceDestroy Boolean
id String
The provider-assigned unique ID for this managed resource.
labels Map<String>
name String
numNodes Number
processingUnits Number
pulumiLabels Map<String>
state String
config String
displayName String
project String

Supporting Types

GetInstanceAutoscalingConfig

AsymmetricAutoscalingOptions This property is required. List<GetInstanceAutoscalingConfigAsymmetricAutoscalingOption>
Asymmetric autoscaling options for specific replicas.
AutoscalingLimits This property is required. List<GetInstanceAutoscalingConfigAutoscalingLimit>
Defines scale in controls to reduce the risk of response latency and outages due to abrupt scale-in events. Users can define the minimum and maximum compute capacity allocated to the instance, and the autoscaler will only scale within that range. Users can either use nodes or processing units to specify the limits, but should use the same unit to set both the min_limit and max_limit.
AutoscalingTargets This property is required. List<GetInstanceAutoscalingConfigAutoscalingTarget>
Defines scale in controls to reduce the risk of response latency and outages due to abrupt scale-in events
AsymmetricAutoscalingOptions This property is required. []GetInstanceAutoscalingConfigAsymmetricAutoscalingOption
Asymmetric autoscaling options for specific replicas.
AutoscalingLimits This property is required. []GetInstanceAutoscalingConfigAutoscalingLimit
Defines scale in controls to reduce the risk of response latency and outages due to abrupt scale-in events. Users can define the minimum and maximum compute capacity allocated to the instance, and the autoscaler will only scale within that range. Users can either use nodes or processing units to specify the limits, but should use the same unit to set both the min_limit and max_limit.
AutoscalingTargets This property is required. []GetInstanceAutoscalingConfigAutoscalingTarget
Defines scale in controls to reduce the risk of response latency and outages due to abrupt scale-in events
asymmetricAutoscalingOptions This property is required. List<GetInstanceAutoscalingConfigAsymmetricAutoscalingOption>
Asymmetric autoscaling options for specific replicas.
autoscalingLimits This property is required. List<GetInstanceAutoscalingConfigAutoscalingLimit>
Defines scale in controls to reduce the risk of response latency and outages due to abrupt scale-in events. Users can define the minimum and maximum compute capacity allocated to the instance, and the autoscaler will only scale within that range. Users can either use nodes or processing units to specify the limits, but should use the same unit to set both the min_limit and max_limit.
autoscalingTargets This property is required. List<GetInstanceAutoscalingConfigAutoscalingTarget>
Defines scale in controls to reduce the risk of response latency and outages due to abrupt scale-in events
asymmetricAutoscalingOptions This property is required. GetInstanceAutoscalingConfigAsymmetricAutoscalingOption[]
Asymmetric autoscaling options for specific replicas.
autoscalingLimits This property is required. GetInstanceAutoscalingConfigAutoscalingLimit[]
Defines scale in controls to reduce the risk of response latency and outages due to abrupt scale-in events. Users can define the minimum and maximum compute capacity allocated to the instance, and the autoscaler will only scale within that range. Users can either use nodes or processing units to specify the limits, but should use the same unit to set both the min_limit and max_limit.
autoscalingTargets This property is required. GetInstanceAutoscalingConfigAutoscalingTarget[]
Defines scale in controls to reduce the risk of response latency and outages due to abrupt scale-in events
asymmetric_autoscaling_options This property is required. Sequence[GetInstanceAutoscalingConfigAsymmetricAutoscalingOption]
Asymmetric autoscaling options for specific replicas.
autoscaling_limits This property is required. Sequence[GetInstanceAutoscalingConfigAutoscalingLimit]
Defines scale in controls to reduce the risk of response latency and outages due to abrupt scale-in events. Users can define the minimum and maximum compute capacity allocated to the instance, and the autoscaler will only scale within that range. Users can either use nodes or processing units to specify the limits, but should use the same unit to set both the min_limit and max_limit.
autoscaling_targets This property is required. Sequence[GetInstanceAutoscalingConfigAutoscalingTarget]
Defines scale in controls to reduce the risk of response latency and outages due to abrupt scale-in events
asymmetricAutoscalingOptions This property is required. List<Property Map>
Asymmetric autoscaling options for specific replicas.
autoscalingLimits This property is required. List<Property Map>
Defines scale in controls to reduce the risk of response latency and outages due to abrupt scale-in events. Users can define the minimum and maximum compute capacity allocated to the instance, and the autoscaler will only scale within that range. Users can either use nodes or processing units to specify the limits, but should use the same unit to set both the min_limit and max_limit.
autoscalingTargets This property is required. List<Property Map>
Defines scale in controls to reduce the risk of response latency and outages due to abrupt scale-in events

GetInstanceAutoscalingConfigAsymmetricAutoscalingOption

overrides This property is required. List<Property Map>
A nested object resource.
replicaSelections This property is required. List<Property Map>
A nested object resource.

GetInstanceAutoscalingConfigAsymmetricAutoscalingOptionOverride

autoscalingLimits This property is required. List<Property Map>
A nested object resource.

GetInstanceAutoscalingConfigAsymmetricAutoscalingOptionOverrideAutoscalingLimit

MaxNodes This property is required. int
The maximum number of nodes for this specific replica.
MinNodes This property is required. int
The minimum number of nodes for this specific replica.
MaxNodes This property is required. int
The maximum number of nodes for this specific replica.
MinNodes This property is required. int
The minimum number of nodes for this specific replica.
maxNodes This property is required. Integer
The maximum number of nodes for this specific replica.
minNodes This property is required. Integer
The minimum number of nodes for this specific replica.
maxNodes This property is required. number
The maximum number of nodes for this specific replica.
minNodes This property is required. number
The minimum number of nodes for this specific replica.
max_nodes This property is required. int
The maximum number of nodes for this specific replica.
min_nodes This property is required. int
The minimum number of nodes for this specific replica.
maxNodes This property is required. Number
The maximum number of nodes for this specific replica.
minNodes This property is required. Number
The minimum number of nodes for this specific replica.

GetInstanceAutoscalingConfigAsymmetricAutoscalingOptionReplicaSelection

Location This property is required. string
The location of the replica to apply asymmetric autoscaling options.
Location This property is required. string
The location of the replica to apply asymmetric autoscaling options.
location This property is required. String
The location of the replica to apply asymmetric autoscaling options.
location This property is required. string
The location of the replica to apply asymmetric autoscaling options.
location This property is required. str
The location of the replica to apply asymmetric autoscaling options.
location This property is required. String
The location of the replica to apply asymmetric autoscaling options.

GetInstanceAutoscalingConfigAutoscalingLimit

MaxNodes This property is required. int
Specifies maximum number of nodes allocated to the instance. If set, this number should be greater than or equal to min_nodes.
MaxProcessingUnits This property is required. int
Specifies maximum number of processing units allocated to the instance. If set, this number should be multiples of 1000 and be greater than or equal to min_processing_units.
MinNodes This property is required. int
Specifies number of nodes allocated to the instance. If set, this number should be greater than or equal to 1.
MinProcessingUnits This property is required. int
Specifies minimum number of processing units allocated to the instance. If set, this number should be multiples of 1000.
MaxNodes This property is required. int
Specifies maximum number of nodes allocated to the instance. If set, this number should be greater than or equal to min_nodes.
MaxProcessingUnits This property is required. int
Specifies maximum number of processing units allocated to the instance. If set, this number should be multiples of 1000 and be greater than or equal to min_processing_units.
MinNodes This property is required. int
Specifies number of nodes allocated to the instance. If set, this number should be greater than or equal to 1.
MinProcessingUnits This property is required. int
Specifies minimum number of processing units allocated to the instance. If set, this number should be multiples of 1000.
maxNodes This property is required. Integer
Specifies maximum number of nodes allocated to the instance. If set, this number should be greater than or equal to min_nodes.
maxProcessingUnits This property is required. Integer
Specifies maximum number of processing units allocated to the instance. If set, this number should be multiples of 1000 and be greater than or equal to min_processing_units.
minNodes This property is required. Integer
Specifies number of nodes allocated to the instance. If set, this number should be greater than or equal to 1.
minProcessingUnits This property is required. Integer
Specifies minimum number of processing units allocated to the instance. If set, this number should be multiples of 1000.
maxNodes This property is required. number
Specifies maximum number of nodes allocated to the instance. If set, this number should be greater than or equal to min_nodes.
maxProcessingUnits This property is required. number
Specifies maximum number of processing units allocated to the instance. If set, this number should be multiples of 1000 and be greater than or equal to min_processing_units.
minNodes This property is required. number
Specifies number of nodes allocated to the instance. If set, this number should be greater than or equal to 1.
minProcessingUnits This property is required. number
Specifies minimum number of processing units allocated to the instance. If set, this number should be multiples of 1000.
max_nodes This property is required. int
Specifies maximum number of nodes allocated to the instance. If set, this number should be greater than or equal to min_nodes.
max_processing_units This property is required. int
Specifies maximum number of processing units allocated to the instance. If set, this number should be multiples of 1000 and be greater than or equal to min_processing_units.
min_nodes This property is required. int
Specifies number of nodes allocated to the instance. If set, this number should be greater than or equal to 1.
min_processing_units This property is required. int
Specifies minimum number of processing units allocated to the instance. If set, this number should be multiples of 1000.
maxNodes This property is required. Number
Specifies maximum number of nodes allocated to the instance. If set, this number should be greater than or equal to min_nodes.
maxProcessingUnits This property is required. Number
Specifies maximum number of processing units allocated to the instance. If set, this number should be multiples of 1000 and be greater than or equal to min_processing_units.
minNodes This property is required. Number
Specifies number of nodes allocated to the instance. If set, this number should be greater than or equal to 1.
minProcessingUnits This property is required. Number
Specifies minimum number of processing units allocated to the instance. If set, this number should be multiples of 1000.

GetInstanceAutoscalingConfigAutoscalingTarget

HighPriorityCpuUtilizationPercent This property is required. int
Specifies the target high priority cpu utilization percentage that the autoscaler should be trying to achieve for the instance. This number is on a scale from 0 (no utilization) to 100 (full utilization)..
StorageUtilizationPercent This property is required. int
Specifies the target storage utilization percentage that the autoscaler should be trying to achieve for the instance. This number is on a scale from 0 (no utilization) to 100 (full utilization).
HighPriorityCpuUtilizationPercent This property is required. int
Specifies the target high priority cpu utilization percentage that the autoscaler should be trying to achieve for the instance. This number is on a scale from 0 (no utilization) to 100 (full utilization)..
StorageUtilizationPercent This property is required. int
Specifies the target storage utilization percentage that the autoscaler should be trying to achieve for the instance. This number is on a scale from 0 (no utilization) to 100 (full utilization).
highPriorityCpuUtilizationPercent This property is required. Integer
Specifies the target high priority cpu utilization percentage that the autoscaler should be trying to achieve for the instance. This number is on a scale from 0 (no utilization) to 100 (full utilization)..
storageUtilizationPercent This property is required. Integer
Specifies the target storage utilization percentage that the autoscaler should be trying to achieve for the instance. This number is on a scale from 0 (no utilization) to 100 (full utilization).
highPriorityCpuUtilizationPercent This property is required. number
Specifies the target high priority cpu utilization percentage that the autoscaler should be trying to achieve for the instance. This number is on a scale from 0 (no utilization) to 100 (full utilization)..
storageUtilizationPercent This property is required. number
Specifies the target storage utilization percentage that the autoscaler should be trying to achieve for the instance. This number is on a scale from 0 (no utilization) to 100 (full utilization).
high_priority_cpu_utilization_percent This property is required. int
Specifies the target high priority cpu utilization percentage that the autoscaler should be trying to achieve for the instance. This number is on a scale from 0 (no utilization) to 100 (full utilization)..
storage_utilization_percent This property is required. int
Specifies the target storage utilization percentage that the autoscaler should be trying to achieve for the instance. This number is on a scale from 0 (no utilization) to 100 (full utilization).
highPriorityCpuUtilizationPercent This property is required. Number
Specifies the target high priority cpu utilization percentage that the autoscaler should be trying to achieve for the instance. This number is on a scale from 0 (no utilization) to 100 (full utilization)..
storageUtilizationPercent This property is required. Number
Specifies the target storage utilization percentage that the autoscaler should be trying to achieve for the instance. This number is on a scale from 0 (no utilization) to 100 (full utilization).

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.
Google Cloud v8.27.0 published on Thursday, Apr 17, 2025 by Pulumi