Google Cloud (GCP) Classic

Pulumi Official
Package maintained by Pulumi
v6.25.0 published on Wednesday, May 25, 2022 by Pulumi

getEngineVersions

Provides access to available Google Kubernetes Engine versions in a zone or region for a given project.

If you are using the gcp.container.getEngineVersions datasource with a regional cluster, ensure that you have provided a region as the location to the datasource. A region can have a different set of supported versions than its component zones, and not all zones in a region are guaranteed to support the same version.

Example Usage

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
    public MyStack()
    {
        var central1b = Output.Create(Gcp.Container.GetEngineVersions.InvokeAsync(new Gcp.Container.GetEngineVersionsArgs
        {
            Location = "us-central1-b",
            VersionPrefix = "1.12.",
        }));
        var foo = new Gcp.Container.Cluster("foo", new Gcp.Container.ClusterArgs
        {
            Location = "us-central1-b",
            NodeVersion = central1b.Apply(central1b => central1b.LatestNodeVersion),
            InitialNodeCount = 1,
        });
        this.StableChannelVersion = central1b.Apply(central1b => central1b.ReleaseChannelDefaultVersion?.STABLE);
    }

    [Output("stableChannelVersion")]
    public Output<string> StableChannelVersion { get; set; }
}
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/container"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		central1b, err := container.GetEngineVersions(ctx, &container.GetEngineVersionsArgs{
			Location:      pulumi.StringRef("us-central1-b"),
			VersionPrefix: pulumi.StringRef("1.12."),
		}, nil)
		if err != nil {
			return err
		}
		_, err = container.NewCluster(ctx, "foo", &container.ClusterArgs{
			Location:         pulumi.String("us-central1-b"),
			NodeVersion:      pulumi.String(central1b.LatestNodeVersion),
			InitialNodeCount: pulumi.Int(1),
		})
		if err != nil {
			return err
		}
		ctx.Export("stableChannelVersion", central1b.ReleaseChannelDefaultVersion.STABLE)
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var central1b = Output.of(ContainerFunctions.getEngineVersions(GetEngineVersionsArgs.builder()
            .location("us-central1-b")
            .versionPrefix("1.12.")
            .build()));

        var foo = new Cluster("foo", ClusterArgs.builder()        
            .location("us-central1-b")
            .nodeVersion(central1b.apply(getEngineVersionsResult -> getEngineVersionsResult.latestNodeVersion()))
            .initialNodeCount(1)
            .build());

        ctx.export("stableChannelVersion", central1b.apply(getEngineVersionsResult -> getEngineVersionsResult.releaseChannelDefaultVersion().STABLE()));
    }
}
import pulumi
import pulumi_gcp as gcp

central1b = gcp.container.get_engine_versions(location="us-central1-b",
    version_prefix="1.12.")
foo = gcp.container.Cluster("foo",
    location="us-central1-b",
    node_version=central1b.latest_node_version,
    initial_node_count=1)
pulumi.export("stableChannelVersion", central1b.release_channel_default_version["STABLE"])
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const central1b = gcp.container.getEngineVersions({
    location: "us-central1-b",
    versionPrefix: "1.12.",
});
const foo = new gcp.container.Cluster("foo", {
    location: "us-central1-b",
    nodeVersion: central1b.then(central1b => central1b.latestNodeVersion),
    initialNodeCount: 1,
});
export const stableChannelVersion = central1b.then(central1b => central1b.releaseChannelDefaultVersion?.STABLE);
resources:
  foo:
    type: gcp:container:Cluster
    properties:
      location: us-central1-b
      nodeVersion: ${central1b.latestNodeVersion}
      initialNodeCount: 1
variables:
  central1b:
    Fn::Invoke:
      Function: gcp:container:getEngineVersions
      Arguments:
        location: us-central1-b
        versionPrefix: 1.12.
outputs:
  stableChannelVersion: ${central1b.releaseChannelDefaultVersion.STABLE}

Using getEngineVersions

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 getEngineVersions(args: GetEngineVersionsArgs, opts?: InvokeOptions): Promise<GetEngineVersionsResult>
function getEngineVersionsOutput(args: GetEngineVersionsOutputArgs, opts?: InvokeOptions): Output<GetEngineVersionsResult>
def get_engine_versions(location: Optional[str] = None,
                        project: Optional[str] = None,
                        version_prefix: Optional[str] = None,
                        opts: Optional[InvokeOptions] = None) -> GetEngineVersionsResult
def get_engine_versions_output(location: Optional[pulumi.Input[str]] = None,
                        project: Optional[pulumi.Input[str]] = None,
                        version_prefix: Optional[pulumi.Input[str]] = None,
                        opts: Optional[InvokeOptions] = None) -> Output[GetEngineVersionsResult]
func GetEngineVersions(ctx *Context, args *GetEngineVersionsArgs, opts ...InvokeOption) (*GetEngineVersionsResult, error)
func GetEngineVersionsOutput(ctx *Context, args *GetEngineVersionsOutputArgs, opts ...InvokeOption) GetEngineVersionsResultOutput

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

public static class GetEngineVersions 
{
    public static Task<GetEngineVersionsResult> InvokeAsync(GetEngineVersionsArgs args, InvokeOptions? opts = null)
    public static Output<GetEngineVersionsResult> Invoke(GetEngineVersionsInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetEngineVersionsResult> getEngineVersions(GetEngineVersionsArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: gcp:container/getEngineVersions:getEngineVersions
  Arguments:
    # Arguments dictionary

The following arguments are supported:

Location string

The location (region or zone) to list versions for. Must exactly match the location the cluster will be deployed in, or listed versions may not be available. If location, region, and zone are not specified, the provider-level zone must be set and is used instead.

Project string

ID of the project to list available cluster versions for. Should match the project the cluster will be deployed to. Defaults to the project that the provider is authenticated with.

VersionPrefix string

If provided, the provider will only return versions that match the string prefix. For example, 1.11. will match all 1.11 series releases. Since this is just a string match, it's recommended that you append a . after minor versions to ensure that prefixes such as 1.1 don't match versions like 1.12.5-gke.10 accidentally. See the docs on versioning schema for full details on how version strings are formatted.

Location string

The location (region or zone) to list versions for. Must exactly match the location the cluster will be deployed in, or listed versions may not be available. If location, region, and zone are not specified, the provider-level zone must be set and is used instead.

Project string

ID of the project to list available cluster versions for. Should match the project the cluster will be deployed to. Defaults to the project that the provider is authenticated with.

VersionPrefix string

If provided, the provider will only return versions that match the string prefix. For example, 1.11. will match all 1.11 series releases. Since this is just a string match, it's recommended that you append a . after minor versions to ensure that prefixes such as 1.1 don't match versions like 1.12.5-gke.10 accidentally. See the docs on versioning schema for full details on how version strings are formatted.

location String

The location (region or zone) to list versions for. Must exactly match the location the cluster will be deployed in, or listed versions may not be available. If location, region, and zone are not specified, the provider-level zone must be set and is used instead.

project String

ID of the project to list available cluster versions for. Should match the project the cluster will be deployed to. Defaults to the project that the provider is authenticated with.

versionPrefix String

If provided, the provider will only return versions that match the string prefix. For example, 1.11. will match all 1.11 series releases. Since this is just a string match, it's recommended that you append a . after minor versions to ensure that prefixes such as 1.1 don't match versions like 1.12.5-gke.10 accidentally. See the docs on versioning schema for full details on how version strings are formatted.

location string

The location (region or zone) to list versions for. Must exactly match the location the cluster will be deployed in, or listed versions may not be available. If location, region, and zone are not specified, the provider-level zone must be set and is used instead.

project string

ID of the project to list available cluster versions for. Should match the project the cluster will be deployed to. Defaults to the project that the provider is authenticated with.

versionPrefix string

If provided, the provider will only return versions that match the string prefix. For example, 1.11. will match all 1.11 series releases. Since this is just a string match, it's recommended that you append a . after minor versions to ensure that prefixes such as 1.1 don't match versions like 1.12.5-gke.10 accidentally. See the docs on versioning schema for full details on how version strings are formatted.

location str

The location (region or zone) to list versions for. Must exactly match the location the cluster will be deployed in, or listed versions may not be available. If location, region, and zone are not specified, the provider-level zone must be set and is used instead.

project str

ID of the project to list available cluster versions for. Should match the project the cluster will be deployed to. Defaults to the project that the provider is authenticated with.

version_prefix str

If provided, the provider will only return versions that match the string prefix. For example, 1.11. will match all 1.11 series releases. Since this is just a string match, it's recommended that you append a . after minor versions to ensure that prefixes such as 1.1 don't match versions like 1.12.5-gke.10 accidentally. See the docs on versioning schema for full details on how version strings are formatted.

location String

The location (region or zone) to list versions for. Must exactly match the location the cluster will be deployed in, or listed versions may not be available. If location, region, and zone are not specified, the provider-level zone must be set and is used instead.

project String

ID of the project to list available cluster versions for. Should match the project the cluster will be deployed to. Defaults to the project that the provider is authenticated with.

versionPrefix String

If provided, the provider will only return versions that match the string prefix. For example, 1.11. will match all 1.11 series releases. Since this is just a string match, it's recommended that you append a . after minor versions to ensure that prefixes such as 1.1 don't match versions like 1.12.5-gke.10 accidentally. See the docs on versioning schema for full details on how version strings are formatted.

getEngineVersions Result

The following output properties are available:

DefaultClusterVersion string

Version of Kubernetes the service deploys by default.

Id string

The provider-assigned unique ID for this managed resource.

LatestMasterVersion string

The latest version available in the given zone for use with master instances.

LatestNodeVersion string

The latest version available in the given zone for use with node instances.

ReleaseChannelDefaultVersion Dictionary<string, string>

A map from a release channel name to the channel's default version.

ValidMasterVersions List<string>

A list of versions available in the given zone for use with master instances.

ValidNodeVersions List<string>

A list of versions available in the given zone for use with node instances.

Location string
Project string
VersionPrefix string
DefaultClusterVersion string

Version of Kubernetes the service deploys by default.

Id string

The provider-assigned unique ID for this managed resource.

LatestMasterVersion string

The latest version available in the given zone for use with master instances.

LatestNodeVersion string

The latest version available in the given zone for use with node instances.

ReleaseChannelDefaultVersion map[string]string

A map from a release channel name to the channel's default version.

ValidMasterVersions []string

A list of versions available in the given zone for use with master instances.

ValidNodeVersions []string

A list of versions available in the given zone for use with node instances.

Location string
Project string
VersionPrefix string
defaultClusterVersion String

Version of Kubernetes the service deploys by default.

id String

The provider-assigned unique ID for this managed resource.

latestMasterVersion String

The latest version available in the given zone for use with master instances.

latestNodeVersion String

The latest version available in the given zone for use with node instances.

releaseChannelDefaultVersion Map<String,String>

A map from a release channel name to the channel's default version.

validMasterVersions List<String>

A list of versions available in the given zone for use with master instances.

validNodeVersions List<String>

A list of versions available in the given zone for use with node instances.

location String
project String
versionPrefix String
defaultClusterVersion string

Version of Kubernetes the service deploys by default.

id string

The provider-assigned unique ID for this managed resource.

latestMasterVersion string

The latest version available in the given zone for use with master instances.

latestNodeVersion string

The latest version available in the given zone for use with node instances.

releaseChannelDefaultVersion {[key: string]: string}

A map from a release channel name to the channel's default version.

validMasterVersions string[]

A list of versions available in the given zone for use with master instances.

validNodeVersions string[]

A list of versions available in the given zone for use with node instances.

location string
project string
versionPrefix string
default_cluster_version str

Version of Kubernetes the service deploys by default.

id str

The provider-assigned unique ID for this managed resource.

latest_master_version str

The latest version available in the given zone for use with master instances.

latest_node_version str

The latest version available in the given zone for use with node instances.

release_channel_default_version Mapping[str, str]

A map from a release channel name to the channel's default version.

valid_master_versions Sequence[str]

A list of versions available in the given zone for use with master instances.

valid_node_versions Sequence[str]

A list of versions available in the given zone for use with node instances.

location str
project str
version_prefix str
defaultClusterVersion String

Version of Kubernetes the service deploys by default.

id String

The provider-assigned unique ID for this managed resource.

latestMasterVersion String

The latest version available in the given zone for use with master instances.

latestNodeVersion String

The latest version available in the given zone for use with node instances.

releaseChannelDefaultVersion Map<String>

A map from a release channel name to the channel's default version.

validMasterVersions List<String>

A list of versions available in the given zone for use with master instances.

validNodeVersions List<String>

A list of versions available in the given zone for use with node instances.

location String
project String
versionPrefix String

Package Details

Repository
https://github.com/pulumi/pulumi-gcp
License
Apache-2.0
Notes

This Pulumi package is based on the google-beta Terraform Provider.