get Cluster
Get info about a GKE cluster from its name and location.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const myCluster = gcp.container.getCluster({
name: "my-cluster",
location: "us-east1-a",
});
export const endpoint = myCluster.then(myCluster => myCluster.endpoint);
export const instanceGroupUrls = myCluster.then(myCluster => myCluster.nodePools?.[0]?.instanceGroupUrls);
export const nodeConfig = myCluster.then(myCluster => myCluster.nodeConfigs);
export const nodePools = myCluster.then(myCluster => myCluster.nodePools);
Content copied to clipboard
import pulumi
import pulumi_gcp as gcp
my_cluster = gcp.container.get_cluster(name="my-cluster",
location="us-east1-a")
pulumi.export("endpoint", my_cluster.endpoint)
pulumi.export("instanceGroupUrls", my_cluster.node_pools[0].instance_group_urls)
pulumi.export("nodeConfig", my_cluster.node_configs)
pulumi.export("nodePools", my_cluster.node_pools)
Content copied to clipboard
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var myCluster = Gcp.Container.GetCluster.Invoke(new()
{
Name = "my-cluster",
Location = "us-east1-a",
});
return new Dictionary<string, object?>
{
["endpoint"] = myCluster.Apply(getClusterResult => getClusterResult.Endpoint),
["instanceGroupUrls"] = myCluster.Apply(getClusterResult => getClusterResult.NodePools[0]?.InstanceGroupUrls),
["nodeConfig"] = myCluster.Apply(getClusterResult => getClusterResult.NodeConfigs),
["nodePools"] = myCluster.Apply(getClusterResult => getClusterResult.NodePools),
};
});
Content copied to clipboard
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/container"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
myCluster, err := container.LookupCluster(ctx, &container.LookupClusterArgs{
Name: "my-cluster",
Location: pulumi.StringRef("us-east1-a"),
}, nil)
if err != nil {
return err
}
ctx.Export("endpoint", myCluster.Endpoint)
ctx.Export("instanceGroupUrls", myCluster.NodePools[0].InstanceGroupUrls)
ctx.Export("nodeConfig", myCluster.NodeConfigs)
ctx.Export("nodePools", myCluster.NodePools)
return nil
})
}
Content copied to clipboard
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.container.ContainerFunctions;
import com.pulumi.gcp.container.inputs.GetClusterArgs;
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 myCluster = ContainerFunctions.getCluster(GetClusterArgs.builder()
.name("my-cluster")
.location("us-east1-a")
.build());
ctx.export("endpoint", myCluster.endpoint());
ctx.export("instanceGroupUrls", myCluster.nodePools()[0].instanceGroupUrls());
ctx.export("nodeConfig", myCluster.nodeConfigs());
ctx.export("nodePools", myCluster.nodePools());
}
}
Content copied to clipboard
variables:
myCluster:
fn::invoke:
function: gcp:container:getCluster
arguments:
name: my-cluster
location: us-east1-a
outputs:
endpoint: ${myCluster.endpoint}
instanceGroupUrls: ${myCluster.nodePools[0].instanceGroupUrls}
nodeConfig: ${myCluster.nodeConfigs}
nodePools: ${myCluster.nodePools}
Content copied to clipboard
Return
A collection of values returned by getCluster.
Parameters
argument
A collection of arguments for invoking getCluster.
suspend fun getCluster(location: String? = null, name: String, project: String? = null): GetClusterResult
Return
A collection of values returned by getCluster.
Parameters
location
The location (zone or region) this cluster has been created in. One of location
, region
, zone
, or a provider-level zone
must be specified.
name
The name of the cluster.
project
The project in which the resource belongs. If it is not provided, the provider project is used.
See also
Return
A collection of values returned by getCluster.
Parameters
argument
Builder for com.pulumi.gcp.container.kotlin.inputs.GetClusterPlainArgs.