1. Packages
  2. Spectrocloud Provider
  3. API Docs
  4. getCluster
spectrocloud 0.23.4 published on Monday, Apr 14, 2025 by spectrocloud

spectrocloud.getCluster

Explore with Pulumi AI

spectrocloud 0.23.4 published on Monday, Apr 14, 2025 by spectrocloud

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as local from "@pulumi/local";
import * as spectrocloud from "@pulumi/spectrocloud";

const cluster = spectrocloud.getCluster({
    name: "client-101",
    context: "tenant",
});
const kubeconfig = new local.index.Local_file("kubeconfig", {
    content: cluster.kubeConfig,
    filename: "client-101.kubeconfig",
    filePermission: "0644",
    directoryPermission: "0755",
});
const adminkubeconfig = new local.index.Local_file("adminkubeconfig", {
    content: cluster.adminKubeConfig,
    filename: "admin-client-101.kubeconfig",
    filePermission: "0644",
    directoryPermission: "0755",
});
Copy
import pulumi
import pulumi_local as local
import pulumi_spectrocloud as spectrocloud

cluster = spectrocloud.get_cluster(name="client-101",
    context="tenant")
kubeconfig = local.index.Local_file("kubeconfig",
    content=cluster.kube_config,
    filename=client-101.kubeconfig,
    file_permission=0644,
    directory_permission=0755)
adminkubeconfig = local.index.Local_file("adminkubeconfig",
    content=cluster.admin_kube_config,
    filename=admin-client-101.kubeconfig,
    file_permission=0644,
    directory_permission=0755)
Copy
package main

import (
	"github.com/pulumi/pulumi-local/sdk/go/local"
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/spectrocloud/spectrocloud"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		cluster, err := spectrocloud.GetCluster(ctx, &spectrocloud.GetClusterArgs{
			Name:    "client-101",
			Context: pulumi.StringRef("tenant"),
		}, nil)
		if err != nil {
			return err
		}
		_, err = local.NewLocal_file(ctx, "kubeconfig", &local.Local_fileArgs{
			Content:             cluster.KubeConfig,
			Filename:            "client-101.kubeconfig",
			FilePermission:      "0644",
			DirectoryPermission: "0755",
		})
		if err != nil {
			return err
		}
		_, err = local.NewLocal_file(ctx, "adminkubeconfig", &local.Local_fileArgs{
			Content:             cluster.AdminKubeConfig,
			Filename:            "admin-client-101.kubeconfig",
			FilePermission:      "0644",
			DirectoryPermission: "0755",
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Local = Pulumi.Local;
using Spectrocloud = Pulumi.Spectrocloud;

return await Deployment.RunAsync(() => 
{
    var cluster = Spectrocloud.GetCluster.Invoke(new()
    {
        Name = "client-101",
        Context = "tenant",
    });

    var kubeconfig = new Local.Index.Local_file("kubeconfig", new()
    {
        Content = cluster.Apply(getClusterResult => getClusterResult.KubeConfig),
        Filename = "client-101.kubeconfig",
        FilePermission = "0644",
        DirectoryPermission = "0755",
    });

    var adminkubeconfig = new Local.Index.Local_file("adminkubeconfig", new()
    {
        Content = cluster.Apply(getClusterResult => getClusterResult.AdminKubeConfig),
        Filename = "admin-client-101.kubeconfig",
        FilePermission = "0644",
        DirectoryPermission = "0755",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.spectrocloud.SpectrocloudFunctions;
import com.pulumi.spectrocloud.inputs.GetClusterArgs;
import com.pulumi.local.local_file;
import com.pulumi.local.Local_fileArgs;
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 cluster = SpectrocloudFunctions.getCluster(GetClusterArgs.builder()
            .name("client-101")
            .context("tenant")
            .build());

        var kubeconfig = new Local_file("kubeconfig", Local_fileArgs.builder()
            .content(cluster.applyValue(getClusterResult -> getClusterResult.kubeConfig()))
            .filename("client-101.kubeconfig")
            .filePermission("0644")
            .directoryPermission("0755")
            .build());

        var adminkubeconfig = new Local_file("adminkubeconfig", Local_fileArgs.builder()
            .content(cluster.applyValue(getClusterResult -> getClusterResult.adminKubeConfig()))
            .filename("admin-client-101.kubeconfig")
            .filePermission("0644")
            .directoryPermission("0755")
            .build());

    }
}
Copy
resources:
  kubeconfig:
    type: local:local_file
    properties:
      content: ${cluster.kubeConfig}
      filename: client-101.kubeconfig
      filePermission: '0644'
      directoryPermission: '0755'
  adminkubeconfig:
    type: local:local_file
    properties:
      content: ${cluster.adminKubeConfig}
      filename: admin-client-101.kubeconfig
      filePermission: '0644'
      directoryPermission: '0755'
variables:
  cluster:
    fn::invoke:
      function: spectrocloud:getCluster
      arguments:
        name: client-101
        context: tenant
Copy

Using getCluster

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 getCluster(args: GetClusterArgs, opts?: InvokeOptions): Promise<GetClusterResult>
function getClusterOutput(args: GetClusterOutputArgs, opts?: InvokeOptions): Output<GetClusterResult>
Copy
def get_cluster(context: Optional[str] = None,
                id: Optional[str] = None,
                name: Optional[str] = None,
                virtual: Optional[bool] = None,
                opts: Optional[InvokeOptions] = None) -> GetClusterResult
def get_cluster_output(context: Optional[pulumi.Input[str]] = None,
                id: Optional[pulumi.Input[str]] = None,
                name: Optional[pulumi.Input[str]] = None,
                virtual: Optional[pulumi.Input[bool]] = None,
                opts: Optional[InvokeOptions] = None) -> Output[GetClusterResult]
Copy
func GetCluster(ctx *Context, args *GetClusterArgs, opts ...InvokeOption) (*GetClusterResult, error)
func GetClusterOutput(ctx *Context, args *GetClusterOutputArgs, opts ...InvokeOption) GetClusterResultOutput
Copy

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

public static class GetCluster 
{
    public static Task<GetClusterResult> InvokeAsync(GetClusterArgs args, InvokeOptions? opts = null)
    public static Output<GetClusterResult> Invoke(GetClusterInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetClusterResult> getCluster(GetClusterArgs args, InvokeOptions options)
public static Output<GetClusterResult> getCluster(GetClusterArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: spectrocloud:index/getCluster:getCluster
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Name This property is required. string
The name of the cluster.
Context string
The context of the cluster. Allowed values are project or tenant. Defaults to project.If the project context is specified, the project name will sourced from the provider configuration parameter project_name.
Id string
The ID of this resource.
Virtual bool
If set to true, the cluster will treated as a virtual cluster. Defaults to false.
Name This property is required. string
The name of the cluster.
Context string
The context of the cluster. Allowed values are project or tenant. Defaults to project.If the project context is specified, the project name will sourced from the provider configuration parameter project_name.
Id string
The ID of this resource.
Virtual bool
If set to true, the cluster will treated as a virtual cluster. Defaults to false.
name This property is required. String
The name of the cluster.
context String
The context of the cluster. Allowed values are project or tenant. Defaults to project.If the project context is specified, the project name will sourced from the provider configuration parameter project_name.
id String
The ID of this resource.
virtual Boolean
If set to true, the cluster will treated as a virtual cluster. Defaults to false.
name This property is required. string
The name of the cluster.
context string
The context of the cluster. Allowed values are project or tenant. Defaults to project.If the project context is specified, the project name will sourced from the provider configuration parameter project_name.
id string
The ID of this resource.
virtual boolean
If set to true, the cluster will treated as a virtual cluster. Defaults to false.
name This property is required. str
The name of the cluster.
context str
The context of the cluster. Allowed values are project or tenant. Defaults to project.If the project context is specified, the project name will sourced from the provider configuration parameter project_name.
id str
The ID of this resource.
virtual bool
If set to true, the cluster will treated as a virtual cluster. Defaults to false.
name This property is required. String
The name of the cluster.
context String
The context of the cluster. Allowed values are project or tenant. Defaults to project.If the project context is specified, the project name will sourced from the provider configuration parameter project_name.
id String
The ID of this resource.
virtual Boolean
If set to true, the cluster will treated as a virtual cluster. Defaults to false.

getCluster Result

The following output properties are available:

AdminKubeConfig string
The admin kubeconfig file for accessing the cluster. This is computed automatically.
Id string
The ID of this resource.
KubeConfig string
The kubeconfig file for accessing the cluster as a non-admin user. This is computed automatically.
Name string
The name of the cluster.
Context string
The context of the cluster. Allowed values are project or tenant. Defaults to project.If the project context is specified, the project name will sourced from the provider configuration parameter project_name.
Virtual bool
If set to true, the cluster will treated as a virtual cluster. Defaults to false.
AdminKubeConfig string
The admin kubeconfig file for accessing the cluster. This is computed automatically.
Id string
The ID of this resource.
KubeConfig string
The kubeconfig file for accessing the cluster as a non-admin user. This is computed automatically.
Name string
The name of the cluster.
Context string
The context of the cluster. Allowed values are project or tenant. Defaults to project.If the project context is specified, the project name will sourced from the provider configuration parameter project_name.
Virtual bool
If set to true, the cluster will treated as a virtual cluster. Defaults to false.
adminKubeConfig String
The admin kubeconfig file for accessing the cluster. This is computed automatically.
id String
The ID of this resource.
kubeConfig String
The kubeconfig file for accessing the cluster as a non-admin user. This is computed automatically.
name String
The name of the cluster.
context String
The context of the cluster. Allowed values are project or tenant. Defaults to project.If the project context is specified, the project name will sourced from the provider configuration parameter project_name.
virtual Boolean
If set to true, the cluster will treated as a virtual cluster. Defaults to false.
adminKubeConfig string
The admin kubeconfig file for accessing the cluster. This is computed automatically.
id string
The ID of this resource.
kubeConfig string
The kubeconfig file for accessing the cluster as a non-admin user. This is computed automatically.
name string
The name of the cluster.
context string
The context of the cluster. Allowed values are project or tenant. Defaults to project.If the project context is specified, the project name will sourced from the provider configuration parameter project_name.
virtual boolean
If set to true, the cluster will treated as a virtual cluster. Defaults to false.
admin_kube_config str
The admin kubeconfig file for accessing the cluster. This is computed automatically.
id str
The ID of this resource.
kube_config str
The kubeconfig file for accessing the cluster as a non-admin user. This is computed automatically.
name str
The name of the cluster.
context str
The context of the cluster. Allowed values are project or tenant. Defaults to project.If the project context is specified, the project name will sourced from the provider configuration parameter project_name.
virtual bool
If set to true, the cluster will treated as a virtual cluster. Defaults to false.
adminKubeConfig String
The admin kubeconfig file for accessing the cluster. This is computed automatically.
id String
The ID of this resource.
kubeConfig String
The kubeconfig file for accessing the cluster as a non-admin user. This is computed automatically.
name String
The name of the cluster.
context String
The context of the cluster. Allowed values are project or tenant. Defaults to project.If the project context is specified, the project name will sourced from the provider configuration parameter project_name.
virtual Boolean
If set to true, the cluster will treated as a virtual cluster. Defaults to false.

Package Details

Repository
spectrocloud spectrocloud/terraform-provider-spectrocloud
License
Notes
This Pulumi package is based on the spectrocloud Terraform Provider.
spectrocloud 0.23.4 published on Monday, Apr 14, 2025 by spectrocloud