1. Packages
  2. Spectrocloud Provider
  3. API Docs
  4. getCluster
spectrocloud 0.23.5 published on Sunday, Apr 20, 2025 by spectrocloud

spectrocloud.getCluster

Explore with Pulumi AI

spectrocloud logo
spectrocloud 0.23.5 published on Sunday, Apr 20, 2025 by spectrocloud

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as local from "@pulumi/local";
    import * as spectrocloud from "@pulumi/spectrocloud";
    
    const exampleCluster = spectrocloud.getCluster({
        name: "my-cluster",
        context: "project",
        virtual: false,
    });
    const kubeConfig = new local.index.Local_file("kubeConfig", {
        content: data.spectrocloud_cluster.cluster.kube_config,
        filename: "client-101.kubeconfig",
        filePermission: "0644",
        directoryPermission: "0755",
    });
    const adminKubeConfig = new local.index.Local_file("adminKubeConfig", {
        content: data.spectrocloud_cluster.cluster.admin_kube_config,
        filename: "admin-client-101.kubeconfig",
        filePermission: "0644",
        directoryPermission: "0755",
    });
    
    import pulumi
    import pulumi_local as local
    import pulumi_spectrocloud as spectrocloud
    
    example_cluster = spectrocloud.get_cluster(name="my-cluster",
        context="project",
        virtual=False)
    kube_config = local.index.Local_file("kubeConfig",
        content=data.spectrocloud_cluster.cluster.kube_config,
        filename=client-101.kubeconfig,
        file_permission=0644,
        directory_permission=0755)
    admin_kube_config = local.index.Local_file("adminKubeConfig",
        content=data.spectrocloud_cluster.cluster.admin_kube_config,
        filename=admin-client-101.kubeconfig,
        file_permission=0644,
        directory_permission=0755)
    
    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 {
    		_, err := spectrocloud.GetCluster(ctx, &spectrocloud.GetClusterArgs{
    			Name:    "my-cluster",
    			Context: pulumi.StringRef("project"),
    			Virtual: pulumi.BoolRef(false),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = local.NewLocal_file(ctx, "kubeConfig", &local.Local_fileArgs{
    			Content:             data.Spectrocloud_cluster.Cluster.Kube_config,
    			Filename:            "client-101.kubeconfig",
    			FilePermission:      "0644",
    			DirectoryPermission: "0755",
    		})
    		if err != nil {
    			return err
    		}
    		_, err = local.NewLocal_file(ctx, "adminKubeConfig", &local.Local_fileArgs{
    			Content:             data.Spectrocloud_cluster.Cluster.Admin_kube_config,
    			Filename:            "admin-client-101.kubeconfig",
    			FilePermission:      "0644",
    			DirectoryPermission: "0755",
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Local = Pulumi.Local;
    using Spectrocloud = Pulumi.Spectrocloud;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleCluster = Spectrocloud.GetCluster.Invoke(new()
        {
            Name = "my-cluster",
            Context = "project",
            Virtual = false,
        });
    
        var kubeConfig = new Local.Index.Local_file("kubeConfig", new()
        {
            Content = data.Spectrocloud_cluster.Cluster.Kube_config,
            Filename = "client-101.kubeconfig",
            FilePermission = "0644",
            DirectoryPermission = "0755",
        });
    
        var adminKubeConfig = new Local.Index.Local_file("adminKubeConfig", new()
        {
            Content = data.Spectrocloud_cluster.Cluster.Admin_kube_config,
            Filename = "admin-client-101.kubeconfig",
            FilePermission = "0644",
            DirectoryPermission = "0755",
        });
    
    });
    
    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 exampleCluster = SpectrocloudFunctions.getCluster(GetClusterArgs.builder()
                .name("my-cluster")
                .context("project")
                .virtual(false)
                .build());
    
            var kubeConfig = new Local_file("kubeConfig", Local_fileArgs.builder()
                .content(data.spectrocloud_cluster().cluster().kube_config())
                .filename("client-101.kubeconfig")
                .filePermission("0644")
                .directoryPermission("0755")
                .build());
    
            var adminKubeConfig = new Local_file("adminKubeConfig", Local_fileArgs.builder()
                .content(data.spectrocloud_cluster().cluster().admin_kube_config())
                .filename("admin-client-101.kubeconfig")
                .filePermission("0644")
                .directoryPermission("0755")
                .build());
    
        }
    }
    
    resources:
      kubeConfig:
        type: local:local_file
        properties:
          content: ${data.spectrocloud_cluster.cluster.kube_config}
          filename: client-101.kubeconfig
          filePermission: '0644'
          directoryPermission: '0755'
      adminKubeConfig:
        type: local:local_file
        properties:
          content: ${data.spectrocloud_cluster.cluster.admin_kube_config}
          filename: admin-client-101.kubeconfig
          filePermission: '0644'
          directoryPermission: '0755'
    variables:
      exampleCluster:
        fn::invoke:
          function: spectrocloud:getCluster
          arguments:
            name: my-cluster
            context: project
            virtual: false
    

    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>
    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]
    func GetCluster(ctx *Context, args *GetClusterArgs, opts ...InvokeOption) (*GetClusterResult, error)
    func GetClusterOutput(ctx *Context, args *GetClusterOutputArgs, opts ...InvokeOption) GetClusterResultOutput

    > 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)
    }
    public static CompletableFuture<GetClusterResult> getCluster(GetClusterArgs args, InvokeOptions options)
    public static Output<GetClusterResult> getCluster(GetClusterArgs args, InvokeOptions options)
    
    fn::invoke:
      function: spectrocloud:index/getCluster:getCluster
      arguments:
        # arguments dictionary

    The following arguments are supported:

    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.
    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 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 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 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 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 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 logo
    spectrocloud 0.23.5 published on Sunday, Apr 20, 2025 by spectrocloud