Google Cloud (GCP) Classic

v6.39.0 published on Wednesday, Sep 28, 2022 by Pulumi

getInstance

Get info about a Google Cloud Redis instance.

Example Usage

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

return await Deployment.RunAsync(() => 
{
    var myInstance = Gcp.Redis.GetInstance.Invoke(new()
    {
        Name = "my-redis-instance",
    });

    return new Dictionary<string, object?>
    {
        ["instanceMemorySizeGb"] = myInstance.Apply(getInstanceResult => getInstanceResult.MemorySizeGb),
        ["instanceConnectMode"] = myInstance.Apply(getInstanceResult => getInstanceResult.ConnectMode),
        ["instanceAuthorizedNetwork"] = myInstance.Apply(getInstanceResult => getInstanceResult.AuthorizedNetwork),
    };
});
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		myInstance, err := redis.LookupInstance(ctx, &redis.LookupInstanceArgs{
			Name: "my-redis-instance",
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("instanceMemorySizeGb", myInstance.MemorySizeGb)
		ctx.Export("instanceConnectMode", myInstance.ConnectMode)
		ctx.Export("instanceAuthorizedNetwork", myInstance.AuthorizedNetwork)
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.redis.RedisFunctions;
import com.pulumi.gcp.compute.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 myInstance = RedisFunctions.getInstance(GetInstanceArgs.builder()
            .name("my-redis-instance")
            .build());

        ctx.export("instanceMemorySizeGb", myInstance.applyValue(getInstanceResult -> getInstanceResult.memorySizeGb()));
        ctx.export("instanceConnectMode", myInstance.applyValue(getInstanceResult -> getInstanceResult.connectMode()));
        ctx.export("instanceAuthorizedNetwork", myInstance.applyValue(getInstanceResult -> getInstanceResult.authorizedNetwork()));
    }
}
import pulumi
import pulumi_gcp as gcp

my_instance = gcp.redis.get_instance(name="my-redis-instance")
pulumi.export("instanceMemorySizeGb", my_instance.memory_size_gb)
pulumi.export("instanceConnectMode", my_instance.connect_mode)
pulumi.export("instanceAuthorizedNetwork", my_instance.authorized_network)
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const myInstance = gcp.redis.getInstance({
    name: "my-redis-instance",
});
export const instanceMemorySizeGb = myInstance.then(myInstance => myInstance.memorySizeGb);
export const instanceConnectMode = myInstance.then(myInstance => myInstance.connectMode);
export const instanceAuthorizedNetwork = myInstance.then(myInstance => myInstance.authorizedNetwork);
variables:
  myInstance:
    Fn::Invoke:
      Function: gcp:redis:getInstance
      Arguments:
        name: my-redis-instance
outputs:
  instanceMemorySizeGb: ${myInstance.memorySizeGb}
  instanceConnectMode: ${myInstance.connectMode}
  instanceAuthorizedNetwork: ${myInstance.authorizedNetwork}

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>
def get_instance(name: Optional[str] = None,
                 project: Optional[str] = None,
                 region: Optional[str] = None,
                 opts: Optional[InvokeOptions] = None) -> GetInstanceResult
def get_instance_output(name: Optional[pulumi.Input[str]] = None,
                 project: Optional[pulumi.Input[str]] = None,
                 region: Optional[pulumi.Input[str]] = None,
                 opts: Optional[InvokeOptions] = None) -> Output[GetInstanceResult]
func LookupInstance(ctx *Context, args *LookupInstanceArgs, opts ...InvokeOption) (*LookupInstanceResult, error)
func LookupInstanceOutput(ctx *Context, args *LookupInstanceOutputArgs, opts ...InvokeOption) LookupInstanceResultOutput

> 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)
}
public static CompletableFuture<GetInstanceResult> getInstance(GetInstanceArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: gcp:redis/getInstance:getInstance
  Arguments:
    # Arguments dictionary

The following arguments are supported:

Name string

The name of a Redis instance.

Project string

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

Region string

The region in which the resource belongs. If it is not provided, the provider region is used.

Name string

The name of a Redis instance.

Project string

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

Region string

The region in which the resource belongs. If it is not provided, the provider region is used.

name String

The name of a Redis instance.

project String

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

region String

The region in which the resource belongs. If it is not provided, the provider region is used.

name string

The name of a Redis instance.

project string

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

region string

The region in which the resource belongs. If it is not provided, the provider region is used.

name str

The name of a Redis instance.

project str

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

region str

The region in which the resource belongs. If it is not provided, the provider region is used.

name String

The name of a Redis instance.

project String

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

region String

The region in which the resource belongs. If it is not provided, the provider region is used.

getInstance Result

The following output properties are available:

AlternativeLocationId string
AuthEnabled bool
AuthString string
AuthorizedNetwork string
ConnectMode string
CreateTime string
CurrentLocationId string
CustomerManagedKey string
DisplayName string
Host string
Id string

The provider-assigned unique ID for this managed resource.

Labels Dictionary<string, string>
LocationId string
MaintenancePolicies List<GetInstanceMaintenancePolicy>
MaintenanceSchedules List<GetInstanceMaintenanceSchedule>
MemorySizeGb int
Name string
Nodes List<GetInstanceNode>
PersistenceConfigs List<GetInstancePersistenceConfig>
PersistenceIamIdentity string
Port int
ReadEndpoint string
ReadEndpointPort int
ReadReplicasMode string
RedisConfigs Dictionary<string, string>
RedisVersion string
ReplicaCount int
ReservedIpRange string
SecondaryIpRange string
ServerCaCerts List<GetInstanceServerCaCert>
Tier string
TransitEncryptionMode string
Project string
Region string
AlternativeLocationId string
AuthEnabled bool
AuthString string
AuthorizedNetwork string
ConnectMode string
CreateTime string
CurrentLocationId string
CustomerManagedKey string
DisplayName string
Host string
Id string

The provider-assigned unique ID for this managed resource.

Labels map[string]string
LocationId string
MaintenancePolicies []GetInstanceMaintenancePolicy
MaintenanceSchedules []GetInstanceMaintenanceSchedule
MemorySizeGb int
Name string
Nodes []GetInstanceNode
PersistenceConfigs []GetInstancePersistenceConfig
PersistenceIamIdentity string
Port int
ReadEndpoint string
ReadEndpointPort int
ReadReplicasMode string
RedisConfigs map[string]string
RedisVersion string
ReplicaCount int
ReservedIpRange string
SecondaryIpRange string
ServerCaCerts []GetInstanceServerCaCert
Tier string
TransitEncryptionMode string
Project string
Region string
alternativeLocationId String
authEnabled Boolean
authString String
authorizedNetwork String
connectMode String
createTime String
currentLocationId String
customerManagedKey String
displayName String
host String
id String

The provider-assigned unique ID for this managed resource.

labels Map<String,String>
locationId String
maintenancePolicies List<GetInstanceMaintenancePolicy>
maintenanceSchedules List<GetInstanceMaintenanceSchedule>
memorySizeGb Integer
name String
nodes List<GetInstanceNode>
persistenceConfigs List<GetInstancePersistenceConfig>
persistenceIamIdentity String
port Integer
readEndpoint String
readEndpointPort Integer
readReplicasMode String
redisConfigs Map<String,String>
redisVersion String
replicaCount Integer
reservedIpRange String
secondaryIpRange String
serverCaCerts List<GetInstanceServerCaCert>
tier String
transitEncryptionMode String
project String
region String
alternativeLocationId string
authEnabled boolean
authString string
authorizedNetwork string
connectMode string
createTime string
currentLocationId string
customerManagedKey string
displayName string
host string
id string

The provider-assigned unique ID for this managed resource.

labels {[key: string]: string}
locationId string
maintenancePolicies GetInstanceMaintenancePolicy[]
maintenanceSchedules GetInstanceMaintenanceSchedule[]
memorySizeGb number
name string
nodes GetInstanceNode[]
persistenceConfigs GetInstancePersistenceConfig[]
persistenceIamIdentity string
port number
readEndpoint string
readEndpointPort number
readReplicasMode string
redisConfigs {[key: string]: string}
redisVersion string
replicaCount number
reservedIpRange string
secondaryIpRange string
serverCaCerts GetInstanceServerCaCert[]
tier string
transitEncryptionMode string
project string
region string
alternative_location_id str
auth_enabled bool
auth_string str
authorized_network str
connect_mode str
create_time str
current_location_id str
customer_managed_key str
display_name str
host str
id str

The provider-assigned unique ID for this managed resource.

labels Mapping[str, str]
location_id str
maintenance_policies Sequence[GetInstanceMaintenancePolicy]
maintenance_schedules Sequence[GetInstanceMaintenanceSchedule]
memory_size_gb int
name str
nodes Sequence[GetInstanceNode]
persistence_configs Sequence[GetInstancePersistenceConfig]
persistence_iam_identity str
port int
read_endpoint str
read_endpoint_port int
read_replicas_mode str
redis_configs Mapping[str, str]
redis_version str
replica_count int
reserved_ip_range str
secondary_ip_range str
server_ca_certs Sequence[GetInstanceServerCaCert]
tier str
transit_encryption_mode str
project str
region str

Supporting Types

GetInstanceMaintenancePolicy

GetInstanceMaintenancePolicyWeeklyMaintenanceWindow

GetInstanceMaintenancePolicyWeeklyMaintenanceWindowStartTime

Hours int
Minutes int
Nanos int
Seconds int
Hours int
Minutes int
Nanos int
Seconds int
hours Integer
minutes Integer
nanos Integer
seconds Integer
hours number
minutes number
nanos number
seconds number
hours int
minutes int
nanos int
seconds int
hours Number
minutes Number
nanos Number
seconds Number

GetInstanceMaintenanceSchedule

GetInstanceNode

Id string
Zone string
Id string
Zone string
id String
zone String
id string
zone string
id str
zone str
id String
zone String

GetInstancePersistenceConfig

GetInstanceServerCaCert

Cert string
CreateTime string
ExpireTime string
SerialNumber string
Sha1Fingerprint string
Cert string
CreateTime string
ExpireTime string
SerialNumber string
Sha1Fingerprint string
cert String
createTime String
expireTime String
serialNumber String
sha1Fingerprint String
cert string
createTime string
expireTime string
serialNumber string
sha1Fingerprint string
cert String
createTime String
expireTime String
serialNumber String
sha1Fingerprint String

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.