Google Cloud (GCP) Classic

Pulumi Official
Package maintained by Pulumi
v6.25.0 published on Wednesday, May 25, 2022 by Pulumi

getInstance

Get info about a Google Cloud Redis instance.

Example Usage

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
    public MyStack()
    {
        var myInstance = Output.Create(Gcp.Redis.GetInstance.InvokeAsync(new Gcp.Redis.GetInstanceArgs
        {
            Name = "my-redis-instance",
        }));
        this.InstanceMemorySizeGb = myInstance.Apply(myInstance => myInstance.MemorySizeGb);
        this.InstanceConnectMode = myInstance.Apply(myInstance => myInstance.ConnectMode);
        this.InstanceAuthorizedNetwork = myInstance.Apply(myInstance => myInstance.AuthorizedNetwork);
    }

    [Output("instanceMemorySizeGb")]
    public Output<string> InstanceMemorySizeGb { get; set; }
    [Output("instanceConnectMode")]
    public Output<string> InstanceConnectMode { get; set; }
    [Output("instanceAuthorizedNetwork")]
    public Output<string> InstanceAuthorizedNetwork { get; set; }
}
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 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 myInstance = Output.of(RedisFunctions.getInstance(GetInstanceArgs.builder()
            .name("my-redis-instance")
            .build()));

        ctx.export("instanceMemorySizeGb", myInstance.apply(getInstanceResult -> getInstanceResult.memorySizeGb()));
        ctx.export("instanceConnectMode", myInstance.apply(getInstanceResult -> getInstanceResult.connectMode()));
        ctx.export("instanceAuthorizedNetwork", myInstance.apply(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:

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

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.