DigitalOcean v4.30.2 published on Wednesday, Jun 5, 2024 by Pulumi
digitalocean.getKubernetesVersions
Explore with Pulumi AI
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, nil, 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=digitalocean.KubernetesClusterNodePoolArgs(
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, nil, 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=digitalocean.KubernetesClusterNodePoolArgs(
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:
- Version
Prefix 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 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 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 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.
- version
Prefix 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.
- Latest
Version string - The most recent version available.
- Valid
Versions List<string> - A list of available versions.
- Version
Prefix string
- Id string
- The provider-assigned unique ID for this managed resource.
- Latest
Version string - The most recent version available.
- Valid
Versions []string - A list of available versions.
- Version
Prefix string
- id String
- The provider-assigned unique ID for this managed resource.
- latest
Version String - The most recent version available.
- valid
Versions List<String> - A list of available versions.
- version
Prefix String
- id string
- The provider-assigned unique ID for this managed resource.
- latest
Version string - The most recent version available.
- valid
Versions string[] - A list of available versions.
- version
Prefix 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.
- latest
Version String - The most recent version available.
- valid
Versions List<String> - A list of available versions.
- version
Prefix String
Package Details
- Repository
- DigitalOcean pulumi/pulumi-digitalocean
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
digitalocean
Terraform Provider.