ionoscloud.getK8sClusters
Explore with Pulumi AI
The k8s_clusters data source can be used to search for and return existing kubernetes clusters based on filters used.
Example Usage
By Name
import * as pulumi from "@pulumi/pulumi";
import * as ionoscloud from "@pulumi/ionoscloud";
const example = ionoscloud.getK8sClusters({
    filters: [{
        name: "name",
        value: "k8sClusterExample",
    }],
});
import pulumi
import pulumi_ionoscloud as ionoscloud
example = ionoscloud.get_k8s_clusters(filters=[{
    "name": "name",
    "value": "k8sClusterExample",
}])
package main
import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/ionoscloud/v6/ionoscloud"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := ionoscloud.GetK8sClusters(ctx, &ionoscloud.GetK8sClustersArgs{
			Filters: []ionoscloud.GetK8sClustersFilter{
				{
					Name:  "name",
					Value: "k8sClusterExample",
				},
			},
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Ionoscloud = Pulumi.Ionoscloud;
return await Deployment.RunAsync(() => 
{
    var example = Ionoscloud.GetK8sClusters.Invoke(new()
    {
        Filters = new[]
        {
            new Ionoscloud.Inputs.GetK8sClustersFilterInputArgs
            {
                Name = "name",
                Value = "k8sClusterExample",
            },
        },
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.ionoscloud.IonoscloudFunctions;
import com.pulumi.ionoscloud.inputs.GetK8sClustersArgs;
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 example = IonoscloudFunctions.getK8sClusters(GetK8sClustersArgs.builder()
            .filters(GetK8sClustersFilterArgs.builder()
                .name("name")
                .value("k8sClusterExample")
                .build())
            .build());
    }
}
variables:
  example:
    fn::invoke:
      function: ionoscloud:getK8sClusters
      arguments:
        filters:
          - name: name
            value: k8sClusterExample
By Name and k8s version Family
import * as pulumi from "@pulumi/pulumi";
import * as ionoscloud from "@pulumi/ionoscloud";
const example2 = ionoscloud.getK8sClusters({
    filters: [
        {
            name: "name",
            value: "k8sClusterExample",
        },
        {
            name: "k8s_version",
            value: "1.27",
        },
    ],
});
import pulumi
import pulumi_ionoscloud as ionoscloud
example2 = ionoscloud.get_k8s_clusters(filters=[
    {
        "name": "name",
        "value": "k8sClusterExample",
    },
    {
        "name": "k8s_version",
        "value": "1.27",
    },
])
package main
import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/ionoscloud/v6/ionoscloud"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := ionoscloud.GetK8sClusters(ctx, &ionoscloud.GetK8sClustersArgs{
			Filters: []ionoscloud.GetK8sClustersFilter{
				{
					Name:  "name",
					Value: "k8sClusterExample",
				},
				{
					Name:  "k8s_version",
					Value: "1.27",
				},
			},
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Ionoscloud = Pulumi.Ionoscloud;
return await Deployment.RunAsync(() => 
{
    var example2 = Ionoscloud.GetK8sClusters.Invoke(new()
    {
        Filters = new[]
        {
            new Ionoscloud.Inputs.GetK8sClustersFilterInputArgs
            {
                Name = "name",
                Value = "k8sClusterExample",
            },
            new Ionoscloud.Inputs.GetK8sClustersFilterInputArgs
            {
                Name = "k8s_version",
                Value = "1.27",
            },
        },
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.ionoscloud.IonoscloudFunctions;
import com.pulumi.ionoscloud.inputs.GetK8sClustersArgs;
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 example2 = IonoscloudFunctions.getK8sClusters(GetK8sClustersArgs.builder()
            .filters(            
                GetK8sClustersFilterArgs.builder()
                    .name("name")
                    .value("k8sClusterExample")
                    .build(),
                GetK8sClustersFilterArgs.builder()
                    .name("k8s_version")
                    .value("1.27")
                    .build())
            .build());
    }
}
variables:
  example2:
    fn::invoke:
      function: ionoscloud:getK8sClusters
      arguments:
        filters:
          - name: name
            value: k8sClusterExample
          - name: k8s_version
            value: '1.27'
Retrieve private clusters only, by Name and Cluster State
import * as pulumi from "@pulumi/pulumi";
import * as ionoscloud from "@pulumi/ionoscloud";
const example = ionoscloud.getServers({
    filters: [
        {
            name: "name",
            value: "k8sClusterExample",
        },
        {
            name: "state",
            value: "ACTIVE",
        },
        {
            name: "public",
            value: "false",
        },
    ],
});
import pulumi
import pulumi_ionoscloud as ionoscloud
example = ionoscloud.get_servers(filters=[
    {
        "name": "name",
        "value": "k8sClusterExample",
    },
    {
        "name": "state",
        "value": "ACTIVE",
    },
    {
        "name": "public",
        "value": "false",
    },
])
package main
import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/ionoscloud/v6/ionoscloud"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := ionoscloud.GetServers(ctx, &ionoscloud.GetServersArgs{
			Filters: []ionoscloud.GetServersFilter{
				{
					Name:  "name",
					Value: "k8sClusterExample",
				},
				{
					Name:  "state",
					Value: "ACTIVE",
				},
				{
					Name:  "public",
					Value: "false",
				},
			},
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Ionoscloud = Pulumi.Ionoscloud;
return await Deployment.RunAsync(() => 
{
    var example = Ionoscloud.GetServers.Invoke(new()
    {
        Filters = new[]
        {
            new Ionoscloud.Inputs.GetServersFilterInputArgs
            {
                Name = "name",
                Value = "k8sClusterExample",
            },
            new Ionoscloud.Inputs.GetServersFilterInputArgs
            {
                Name = "state",
                Value = "ACTIVE",
            },
            new Ionoscloud.Inputs.GetServersFilterInputArgs
            {
                Name = "public",
                Value = "false",
            },
        },
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.ionoscloud.IonoscloudFunctions;
import com.pulumi.ionoscloud.inputs.GetServersArgs;
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 example = IonoscloudFunctions.getServers(GetServersArgs.builder()
            .filters(            
                GetServersFilterArgs.builder()
                    .name("name")
                    .value("k8sClusterExample")
                    .build(),
                GetServersFilterArgs.builder()
                    .name("state")
                    .value("ACTIVE")
                    .build(),
                GetServersFilterArgs.builder()
                    .name("public")
                    .value("false")
                    .build())
            .build());
    }
}
variables:
  example:
    fn::invoke:
      function: ionoscloud:getServers
      arguments:
        filters:
          - name: name
            value: k8sClusterExample
          - name: state
            value: ACTIVE
          - name: public
            value: 'false'
Using getK8sClusters
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 getK8sClusters(args: GetK8sClustersArgs, opts?: InvokeOptions): Promise<GetK8sClustersResult>
function getK8sClustersOutput(args: GetK8sClustersOutputArgs, opts?: InvokeOptions): Output<GetK8sClustersResult>def get_k8s_clusters(filters: Optional[Sequence[GetK8sClustersFilter]] = None,
                     id: Optional[str] = None,
                     timeouts: Optional[GetK8sClustersTimeouts] = None,
                     opts: Optional[InvokeOptions] = None) -> GetK8sClustersResult
def get_k8s_clusters_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetK8sClustersFilterArgs]]]] = None,
                     id: Optional[pulumi.Input[str]] = None,
                     timeouts: Optional[pulumi.Input[GetK8sClustersTimeoutsArgs]] = None,
                     opts: Optional[InvokeOptions] = None) -> Output[GetK8sClustersResult]func GetK8sClusters(ctx *Context, args *GetK8sClustersArgs, opts ...InvokeOption) (*GetK8sClustersResult, error)
func GetK8sClustersOutput(ctx *Context, args *GetK8sClustersOutputArgs, opts ...InvokeOption) GetK8sClustersResultOutput> Note: This function is named GetK8sClusters in the Go SDK.
public static class GetK8sClusters 
{
    public static Task<GetK8sClustersResult> InvokeAsync(GetK8sClustersArgs args, InvokeOptions? opts = null)
    public static Output<GetK8sClustersResult> Invoke(GetK8sClustersInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetK8sClustersResult> getK8sClusters(GetK8sClustersArgs args, InvokeOptions options)
public static Output<GetK8sClustersResult> getK8sClusters(GetK8sClustersArgs args, InvokeOptions options)
fn::invoke:
  function: ionoscloud:index/getK8sClusters:getK8sClusters
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Filters
List<Get
K8s Clusters Filter>  One or more property name - value pairs to be used in filtering the cluster list by the specified attributes. You can use most of the top level fields from the k8s_cluster resource except those containing other nested structures such as
maintenance_windoworconfig.NOTE: Filtering uses partial matching for all types of values. Searching for a cluster using
name:testClusterwill find all clusters who have thetestClustersubstring in their name. This also applies to values for properties that would normally be boolean or numerical.- Id string
 - Timeouts
Get
K8s Clusters Timeouts  
- Filters
[]Get
K8s Clusters Filter  One or more property name - value pairs to be used in filtering the cluster list by the specified attributes. You can use most of the top level fields from the k8s_cluster resource except those containing other nested structures such as
maintenance_windoworconfig.NOTE: Filtering uses partial matching for all types of values. Searching for a cluster using
name:testClusterwill find all clusters who have thetestClustersubstring in their name. This also applies to values for properties that would normally be boolean or numerical.- Id string
 - Timeouts
Get
K8s Clusters Timeouts  
- filters
List<Get
K8s Clusters Filter>  One or more property name - value pairs to be used in filtering the cluster list by the specified attributes. You can use most of the top level fields from the k8s_cluster resource except those containing other nested structures such as
maintenance_windoworconfig.NOTE: Filtering uses partial matching for all types of values. Searching for a cluster using
name:testClusterwill find all clusters who have thetestClustersubstring in their name. This also applies to values for properties that would normally be boolean or numerical.- id String
 - timeouts
Get
K8s Clusters Timeouts  
- filters
Get
K8s Clusters Filter[]  One or more property name - value pairs to be used in filtering the cluster list by the specified attributes. You can use most of the top level fields from the k8s_cluster resource except those containing other nested structures such as
maintenance_windoworconfig.NOTE: Filtering uses partial matching for all types of values. Searching for a cluster using
name:testClusterwill find all clusters who have thetestClustersubstring in their name. This also applies to values for properties that would normally be boolean or numerical.- id string
 - timeouts
Get
K8s Clusters Timeouts  
- filters
Sequence[Get
K8s Clusters Filter]  One or more property name - value pairs to be used in filtering the cluster list by the specified attributes. You can use most of the top level fields from the k8s_cluster resource except those containing other nested structures such as
maintenance_windoworconfig.NOTE: Filtering uses partial matching for all types of values. Searching for a cluster using
name:testClusterwill find all clusters who have thetestClustersubstring in their name. This also applies to values for properties that would normally be boolean or numerical.- id str
 - timeouts
Get
K8s Clusters Timeouts  
- filters List<Property Map>
 One or more property name - value pairs to be used in filtering the cluster list by the specified attributes. You can use most of the top level fields from the k8s_cluster resource except those containing other nested structures such as
maintenance_windoworconfig.NOTE: Filtering uses partial matching for all types of values. Searching for a cluster using
name:testClusterwill find all clusters who have thetestClustersubstring in their name. This also applies to values for properties that would normally be boolean or numerical.- id String
 - timeouts Property Map
 
getK8sClusters Result
The following output properties are available:
- Clusters
List<Get
K8s Clusters Cluster>  - list of Kubernetes clusters that match the provided filters. The elements of this list are structurally identical to the 
k8s_clusterdatasource, which is limited to retrieving only 1 cluster in a single query. - Entries double
 - indicates the number of clusters found and added to the list after the query has been performed with the specified filters. For a full reference of all the attributes returned, check out documentation
 - Id string
 - Filters
List<Get
K8s Clusters Filter>  - Timeouts
Get
K8s Clusters Timeouts  
- Clusters
[]Get
K8s Clusters Cluster  - list of Kubernetes clusters that match the provided filters. The elements of this list are structurally identical to the 
k8s_clusterdatasource, which is limited to retrieving only 1 cluster in a single query. - Entries float64
 - indicates the number of clusters found and added to the list after the query has been performed with the specified filters. For a full reference of all the attributes returned, check out documentation
 - Id string
 - Filters
[]Get
K8s Clusters Filter  - Timeouts
Get
K8s Clusters Timeouts  
- clusters
List<Get
K8s Clusters Cluster>  - list of Kubernetes clusters that match the provided filters. The elements of this list are structurally identical to the 
k8s_clusterdatasource, which is limited to retrieving only 1 cluster in a single query. - entries Double
 - indicates the number of clusters found and added to the list after the query has been performed with the specified filters. For a full reference of all the attributes returned, check out documentation
 - id String
 - filters
List<Get
K8s Clusters Filter>  - timeouts
Get
K8s Clusters Timeouts  
- clusters
Get
K8s Clusters Cluster[]  - list of Kubernetes clusters that match the provided filters. The elements of this list are structurally identical to the 
k8s_clusterdatasource, which is limited to retrieving only 1 cluster in a single query. - entries number
 - indicates the number of clusters found and added to the list after the query has been performed with the specified filters. For a full reference of all the attributes returned, check out documentation
 - id string
 - filters
Get
K8s Clusters Filter[]  - timeouts
Get
K8s Clusters Timeouts  
- clusters
Sequence[Get
K8s Clusters Cluster]  - list of Kubernetes clusters that match the provided filters. The elements of this list are structurally identical to the 
k8s_clusterdatasource, which is limited to retrieving only 1 cluster in a single query. - entries float
 - indicates the number of clusters found and added to the list after the query has been performed with the specified filters. For a full reference of all the attributes returned, check out documentation
 - id str
 - filters
Sequence[Get
K8s Clusters Filter]  - timeouts
Get
K8s Clusters Timeouts  
- clusters List<Property Map>
 - list of Kubernetes clusters that match the provided filters. The elements of this list are structurally identical to the 
k8s_clusterdatasource, which is limited to retrieving only 1 cluster in a single query. - entries Number
 - indicates the number of clusters found and added to the list after the query has been performed with the specified filters. For a full reference of all the attributes returned, check out documentation
 - id String
 - filters List<Property Map>
 - timeouts Property Map
 
Supporting Types
GetK8sClustersCluster   
- Api
Subnet List<string>Allow Lists  - Available
Upgrade List<string>Versions  - Ca
Crt string - Configs
List<Get
K8s Clusters Cluster Config>  - Id string
 - K8s
Version string - Kube
Config string - Location string
 - Maintenance
Windows List<GetK8s Clusters Cluster Maintenance Window>  - Name string
 - Nat
Gateway stringIp  - Node
Pools List<string> - Node
Subnet string - Public bool
 - S3Buckets
List<Get
K8s Clusters Cluster S3Bucket>  - Server string
 - State string
 - User
Tokens Dictionary<string, string> - Viable
Node List<string>Pool Versions  
- Api
Subnet []stringAllow Lists  - Available
Upgrade []stringVersions  - Ca
Crt string - Configs
[]Get
K8s Clusters Cluster Config  - Id string
 - K8s
Version string - Kube
Config string - Location string
 - Maintenance
Windows []GetK8s Clusters Cluster Maintenance Window  - Name string
 - Nat
Gateway stringIp  - Node
Pools []string - Node
Subnet string - Public bool
 - S3Buckets
[]Get
K8s Clusters Cluster S3Bucket  - Server string
 - State string
 - User
Tokens map[string]string - Viable
Node []stringPool Versions  
- api
Subnet List<String>Allow Lists  - available
Upgrade List<String>Versions  - ca
Crt String - configs
List<Get
K8s Clusters Cluster Config>  - id String
 - k8s
Version String - kube
Config String - location String
 - maintenance
Windows List<GetK8s Clusters Cluster Maintenance Window>  - name String
 - nat
Gateway StringIp  - node
Pools List<String> - node
Subnet String - public_ Boolean
 - s3Buckets
List<Get
K8s Clusters Cluster S3Bucket>  - server String
 - state String
 - user
Tokens Map<String,String> - viable
Node List<String>Pool Versions  
- api
Subnet string[]Allow Lists  - available
Upgrade string[]Versions  - ca
Crt string - configs
Get
K8s Clusters Cluster Config[]  - id string
 - k8s
Version string - kube
Config string - location string
 - maintenance
Windows GetK8s Clusters Cluster Maintenance Window[]  - name string
 - nat
Gateway stringIp  - node
Pools string[] - node
Subnet string - public boolean
 - s3Buckets
Get
K8s Clusters Cluster S3Bucket[]  - server string
 - state string
 - user
Tokens {[key: string]: string} - viable
Node string[]Pool Versions  
- api_
subnet_ Sequence[str]allow_ lists  - available_
upgrade_ Sequence[str]versions  - ca_
crt str - configs
Sequence[Get
K8s Clusters Cluster Config]  - id str
 - k8s_
version str - kube_
config str - location str
 - maintenance_
windows Sequence[GetK8s Clusters Cluster Maintenance Window]  - name str
 - nat_
gateway_ strip  - node_
pools Sequence[str] - node_
subnet str - public bool
 - s3_
buckets Sequence[GetK8s Clusters Cluster S3Bucket]  - server str
 - state str
 - user_
tokens Mapping[str, str] - viable_
node_ Sequence[str]pool_ versions  
- api
Subnet List<String>Allow Lists  - available
Upgrade List<String>Versions  - ca
Crt String - configs List<Property Map>
 - id String
 - k8s
Version String - kube
Config String - location String
 - maintenance
Windows List<Property Map> - name String
 - nat
Gateway StringIp  - node
Pools List<String> - node
Subnet String - public Boolean
 - s3Buckets List<Property Map>
 - server String
 - state String
 - user
Tokens Map<String> - viable
Node List<String>Pool Versions  
GetK8sClustersClusterConfig    
- Api
Version string - Clusters
List<Get
K8s Clusters Cluster Config Cluster>  - list of Kubernetes clusters that match the provided filters. The elements of this list are structurally identical to the 
k8s_clusterdatasource, which is limited to retrieving only 1 cluster in a single query. - Contexts
List<Get
K8s Clusters Cluster Config Context>  - Current
Context string - Kind string
 - Users
List<Get
K8s Clusters Cluster Config User>  
- Api
Version string - Clusters
[]Get
K8s Clusters Cluster Config Cluster  - list of Kubernetes clusters that match the provided filters. The elements of this list are structurally identical to the 
k8s_clusterdatasource, which is limited to retrieving only 1 cluster in a single query. - Contexts
[]Get
K8s Clusters Cluster Config Context  - Current
Context string - Kind string
 - Users
[]Get
K8s Clusters Cluster Config User  
- api
Version String - clusters
List<Get
K8s Clusters Cluster Config Cluster>  - list of Kubernetes clusters that match the provided filters. The elements of this list are structurally identical to the 
k8s_clusterdatasource, which is limited to retrieving only 1 cluster in a single query. - contexts
List<Get
K8s Clusters Cluster Config Context>  - current
Context String - kind String
 - users
List<Get
K8s Clusters Cluster Config User>  
- api
Version string - clusters
Get
K8s Clusters Cluster Config Cluster[]  - list of Kubernetes clusters that match the provided filters. The elements of this list are structurally identical to the 
k8s_clusterdatasource, which is limited to retrieving only 1 cluster in a single query. - contexts
Get
K8s Clusters Cluster Config Context[]  - current
Context string - kind string
 - users
Get
K8s Clusters Cluster Config User[]  
- api_
version str - clusters
Sequence[Get
K8s Clusters Cluster Config Cluster]  - list of Kubernetes clusters that match the provided filters. The elements of this list are structurally identical to the 
k8s_clusterdatasource, which is limited to retrieving only 1 cluster in a single query. - contexts
Sequence[Get
K8s Clusters Cluster Config Context]  - current_
context str - kind str
 - users
Sequence[Get
K8s Clusters Cluster Config User]  
- api
Version String - clusters List<Property Map>
 - list of Kubernetes clusters that match the provided filters. The elements of this list are structurally identical to the 
k8s_clusterdatasource, which is limited to retrieving only 1 cluster in a single query. - contexts List<Property Map>
 - current
Context String - kind String
 - users List<Property Map>
 
GetK8sClustersClusterConfigCluster     
GetK8sClustersClusterConfigContext     
GetK8sClustersClusterConfigUser     
GetK8sClustersClusterMaintenanceWindow     
- Day
Of stringThe Week  - Time string
 
- Day
Of stringThe Week  - Time string
 
- day
Of StringThe Week  - time String
 
- day
Of stringThe Week  - time string
 
- day_
of_ strthe_ week  - time str
 
- day
Of StringThe Week  - time String
 
GetK8sClustersClusterS3Bucket    
- Name string
 
- Name string
 
- name String
 
- name string
 
- name str
 
- name String
 
GetK8sClustersFilter   
GetK8sClustersTimeouts   
Package Details
- Repository
 - ionoscloud ionos-cloud/terraform-provider-ionoscloud
 - License
 - Notes
 - This Pulumi package is based on the 
ionoscloudTerraform Provider.