1. Packages
  2. Digitalocean Provider
  3. API Docs
  4. getKubernetesVersions
DigitalOcean v4.35.0 published on Tuesday, Nov 19, 2024 by Pulumi

digitalocean.getKubernetesVersions

Explore with Pulumi AI

digitalocean logo
DigitalOcean v4.35.0 published on Tuesday, Nov 19, 2024 by Pulumi

    Provides access to the available DigitalOcean Kubernetes Service versions.

    Example Usage

    Output a list of all available versions

    import * as pulumi from "@pulumi/pulumi";
    import * as digitalocean from "@pulumi/digitalocean";
    
    export = async () => {
        const example = await digitalocean.getKubernetesVersions({});
        return {
            "k8s-versions": example.validVersions,
        };
    }
    
    import pulumi
    import pulumi_digitalocean as digitalocean
    
    example = digitalocean.get_kubernetes_versions()
    pulumi.export("k8s-versions", example.valid_versions)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-digitalocean/sdk/v4/go/digitalocean"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := digitalocean.GetKubernetesVersions(ctx, &digitalocean.GetKubernetesVersionsArgs{}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("k8s-versions", example.ValidVersions)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using DigitalOcean = Pulumi.DigitalOcean;
    
    return await Deployment.RunAsync(() => 
    {
        var example = DigitalOcean.GetKubernetesVersions.Invoke();
    
        return new Dictionary<string, object?>
        {
            ["k8s-versions"] = example.Apply(getKubernetesVersionsResult => getKubernetesVersionsResult.ValidVersions),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.digitalocean.DigitaloceanFunctions;
    import com.pulumi.digitalocean.inputs.GetKubernetesVersionsArgs;
    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 = DigitaloceanFunctions.getKubernetesVersions();
    
            ctx.export("k8s-versions", example.applyValue(getKubernetesVersionsResult -> getKubernetesVersionsResult.validVersions()));
        }
    }
    
    variables:
      example:
        fn::invoke:
          Function: digitalocean:getKubernetesVersions
          Arguments: {}
    outputs:
      k8s-versions: ${example.validVersions}
    

    Create a Kubernetes cluster using the most recent version available

    import * as pulumi from "@pulumi/pulumi";
    import * as digitalocean from "@pulumi/digitalocean";
    
    const example = digitalocean.getKubernetesVersions({});
    const example_cluster = new digitalocean.KubernetesCluster("example-cluster", {
        name: "example-cluster",
        region: digitalocean.Region.LON1,
        version: example.then(example => example.latestVersion),
        nodePool: {
            name: "default",
            size: "s-1vcpu-2gb",
            nodeCount: 3,
        },
    });
    
    import pulumi
    import pulumi_digitalocean as digitalocean
    
    example = digitalocean.get_kubernetes_versions()
    example_cluster = digitalocean.KubernetesCluster("example-cluster",
        name="example-cluster",
        region=digitalocean.Region.LON1,
        version=example.latest_version,
        node_pool={
            "name": "default",
            "size": "s-1vcpu-2gb",
            "node_count": 3,
        })
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-digitalocean/sdk/v4/go/digitalocean"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := digitalocean.GetKubernetesVersions(ctx, &digitalocean.GetKubernetesVersionsArgs{}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = digitalocean.NewKubernetesCluster(ctx, "example-cluster", &digitalocean.KubernetesClusterArgs{
    			Name:    pulumi.String("example-cluster"),
    			Region:  pulumi.String(digitalocean.RegionLON1),
    			Version: pulumi.String(example.LatestVersion),
    			NodePool: &digitalocean.KubernetesClusterNodePoolArgs{
    				Name:      pulumi.String("default"),
    				Size:      pulumi.String("s-1vcpu-2gb"),
    				NodeCount: pulumi.Int(3),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using DigitalOcean = Pulumi.DigitalOcean;
    
    return await Deployment.RunAsync(() => 
    {
        var example = DigitalOcean.GetKubernetesVersions.Invoke();
    
        var example_cluster = new DigitalOcean.KubernetesCluster("example-cluster", new()
        {
            Name = "example-cluster",
            Region = DigitalOcean.Region.LON1,
            Version = example.Apply(getKubernetesVersionsResult => getKubernetesVersionsResult.LatestVersion),
            NodePool = new DigitalOcean.Inputs.KubernetesClusterNodePoolArgs
            {
                Name = "default",
                Size = "s-1vcpu-2gb",
                NodeCount = 3,
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.digitalocean.DigitaloceanFunctions;
    import com.pulumi.digitalocean.inputs.GetKubernetesVersionsArgs;
    import com.pulumi.digitalocean.KubernetesCluster;
    import com.pulumi.digitalocean.KubernetesClusterArgs;
    import com.pulumi.digitalocean.inputs.KubernetesClusterNodePoolArgs;
    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 = DigitaloceanFunctions.getKubernetesVersions();
    
            var example_cluster = new KubernetesCluster("example-cluster", KubernetesClusterArgs.builder()
                .name("example-cluster")
                .region("lon1")
                .version(example.applyValue(getKubernetesVersionsResult -> getKubernetesVersionsResult.latestVersion()))
                .nodePool(KubernetesClusterNodePoolArgs.builder()
                    .name("default")
                    .size("s-1vcpu-2gb")
                    .nodeCount(3)
                    .build())
                .build());
    
        }
    }
    
    resources:
      example-cluster:
        type: digitalocean:KubernetesCluster
        properties:
          name: example-cluster
          region: lon1
          version: ${example.latestVersion}
          nodePool:
            name: default
            size: s-1vcpu-2gb
            nodeCount: 3
    variables:
      example:
        fn::invoke:
          Function: digitalocean:getKubernetesVersions
          Arguments: {}
    

    Pin a Kubernetes cluster to a specific minor version

    import * as pulumi from "@pulumi/pulumi";
    import * as digitalocean from "@pulumi/digitalocean";
    
    const example = digitalocean.getKubernetesVersions({
        versionPrefix: "1.22.",
    });
    const example_cluster = new digitalocean.KubernetesCluster("example-cluster", {
        name: "example-cluster",
        region: digitalocean.Region.LON1,
        version: example.then(example => example.latestVersion),
        nodePool: {
            name: "default",
            size: "s-1vcpu-2gb",
            nodeCount: 3,
        },
    });
    
    import pulumi
    import pulumi_digitalocean as digitalocean
    
    example = digitalocean.get_kubernetes_versions(version_prefix="1.22.")
    example_cluster = digitalocean.KubernetesCluster("example-cluster",
        name="example-cluster",
        region=digitalocean.Region.LON1,
        version=example.latest_version,
        node_pool={
            "name": "default",
            "size": "s-1vcpu-2gb",
            "node_count": 3,
        })
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-digitalocean/sdk/v4/go/digitalocean"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := digitalocean.GetKubernetesVersions(ctx, &digitalocean.GetKubernetesVersionsArgs{
    			VersionPrefix: pulumi.StringRef("1.22."),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = digitalocean.NewKubernetesCluster(ctx, "example-cluster", &digitalocean.KubernetesClusterArgs{
    			Name:    pulumi.String("example-cluster"),
    			Region:  pulumi.String(digitalocean.RegionLON1),
    			Version: pulumi.String(example.LatestVersion),
    			NodePool: &digitalocean.KubernetesClusterNodePoolArgs{
    				Name:      pulumi.String("default"),
    				Size:      pulumi.String("s-1vcpu-2gb"),
    				NodeCount: pulumi.Int(3),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using DigitalOcean = Pulumi.DigitalOcean;
    
    return await Deployment.RunAsync(() => 
    {
        var example = DigitalOcean.GetKubernetesVersions.Invoke(new()
        {
            VersionPrefix = "1.22.",
        });
    
        var example_cluster = new DigitalOcean.KubernetesCluster("example-cluster", new()
        {
            Name = "example-cluster",
            Region = DigitalOcean.Region.LON1,
            Version = example.Apply(getKubernetesVersionsResult => getKubernetesVersionsResult.LatestVersion),
            NodePool = new DigitalOcean.Inputs.KubernetesClusterNodePoolArgs
            {
                Name = "default",
                Size = "s-1vcpu-2gb",
                NodeCount = 3,
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.digitalocean.DigitaloceanFunctions;
    import com.pulumi.digitalocean.inputs.GetKubernetesVersionsArgs;
    import com.pulumi.digitalocean.KubernetesCluster;
    import com.pulumi.digitalocean.KubernetesClusterArgs;
    import com.pulumi.digitalocean.inputs.KubernetesClusterNodePoolArgs;
    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 = DigitaloceanFunctions.getKubernetesVersions(GetKubernetesVersionsArgs.builder()
                .versionPrefix("1.22.")
                .build());
    
            var example_cluster = new KubernetesCluster("example-cluster", KubernetesClusterArgs.builder()
                .name("example-cluster")
                .region("lon1")
                .version(example.applyValue(getKubernetesVersionsResult -> getKubernetesVersionsResult.latestVersion()))
                .nodePool(KubernetesClusterNodePoolArgs.builder()
                    .name("default")
                    .size("s-1vcpu-2gb")
                    .nodeCount(3)
                    .build())
                .build());
    
        }
    }
    
    resources:
      example-cluster:
        type: digitalocean:KubernetesCluster
        properties:
          name: example-cluster
          region: lon1
          version: ${example.latestVersion}
          nodePool:
            name: default
            size: s-1vcpu-2gb
            nodeCount: 3
    variables:
      example:
        fn::invoke:
          Function: digitalocean:getKubernetesVersions
          Arguments:
            versionPrefix: 1.22.
    

    Using getKubernetesVersions

    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 getKubernetesVersions(args: GetKubernetesVersionsArgs, opts?: InvokeOptions): Promise<GetKubernetesVersionsResult>
    function getKubernetesVersionsOutput(args: GetKubernetesVersionsOutputArgs, opts?: InvokeOptions): Output<GetKubernetesVersionsResult>
    def get_kubernetes_versions(version_prefix: Optional[str] = None,
                                opts: Optional[InvokeOptions] = None) -> GetKubernetesVersionsResult
    def get_kubernetes_versions_output(version_prefix: Optional[pulumi.Input[str]] = None,
                                opts: Optional[InvokeOptions] = None) -> Output[GetKubernetesVersionsResult]
    func GetKubernetesVersions(ctx *Context, args *GetKubernetesVersionsArgs, opts ...InvokeOption) (*GetKubernetesVersionsResult, error)
    func GetKubernetesVersionsOutput(ctx *Context, args *GetKubernetesVersionsOutputArgs, opts ...InvokeOption) GetKubernetesVersionsResultOutput

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

    public static class GetKubernetesVersions 
    {
        public static Task<GetKubernetesVersionsResult> InvokeAsync(GetKubernetesVersionsArgs args, InvokeOptions? opts = null)
        public static Output<GetKubernetesVersionsResult> Invoke(GetKubernetesVersionsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetKubernetesVersionsResult> getKubernetesVersions(GetKubernetesVersionsArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: digitalocean:index/getKubernetesVersions:getKubernetesVersions
      arguments:
        # arguments dictionary

    The following arguments are supported:

    VersionPrefix string
    If provided, the provider will only return versions that match the string prefix. For example, 1.15. will match all 1.15.x series releases.
    VersionPrefix string
    If provided, the provider will only return versions that match the string prefix. For example, 1.15. will match all 1.15.x series releases.
    versionPrefix String
    If provided, the provider will only return versions that match the string prefix. For example, 1.15. will match all 1.15.x series releases.
    versionPrefix string
    If provided, the provider will only return versions that match the string prefix. For example, 1.15. will match all 1.15.x series releases.
    version_prefix str
    If provided, the provider will only return versions that match the string prefix. For example, 1.15. will match all 1.15.x series releases.
    versionPrefix String
    If provided, the provider will only return versions that match the string prefix. For example, 1.15. will match all 1.15.x series releases.

    getKubernetesVersions Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    LatestVersion string
    The most recent version available.
    ValidVersions List<string>
    A list of available versions.
    VersionPrefix string
    Id string
    The provider-assigned unique ID for this managed resource.
    LatestVersion string
    The most recent version available.
    ValidVersions []string
    A list of available versions.
    VersionPrefix string
    id String
    The provider-assigned unique ID for this managed resource.
    latestVersion String
    The most recent version available.
    validVersions List<String>
    A list of available versions.
    versionPrefix String
    id string
    The provider-assigned unique ID for this managed resource.
    latestVersion string
    The most recent version available.
    validVersions string[]
    A list of available versions.
    versionPrefix string
    id str
    The provider-assigned unique ID for this managed resource.
    latest_version str
    The most recent version available.
    valid_versions Sequence[str]
    A list of available versions.
    version_prefix str
    id String
    The provider-assigned unique ID for this managed resource.
    latestVersion String
    The most recent version available.
    validVersions List<String>
    A list of available versions.
    versionPrefix String

    Package Details

    Repository
    DigitalOcean pulumi/pulumi-digitalocean
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the digitalocean Terraform Provider.
    digitalocean logo
    DigitalOcean v4.35.0 published on Tuesday, Nov 19, 2024 by Pulumi