1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. container
  5. getEngineVersions
Google Cloud Classic v8.3.1 published on Wednesday, Sep 25, 2024 by Pulumi

gcp.container.getEngineVersions

Explore with Pulumi AI

gcp logo
Google Cloud Classic v8.3.1 published on Wednesday, Sep 25, 2024 by Pulumi

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

    To get more information about GKE versions, see:

    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

    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", {
        name: "test-cluster",
        location: "us-central1-b",
        nodeVersion: central1b.then(central1b => central1b.latestNodeVersion),
        initialNodeCount: 1,
    });
    export const stableChannelDefaultVersion = central1b.then(central1b => central1b.releaseChannelDefaultVersion?.STABLE);
    export const stableChannelLatestVersion = central1b.then(central1b => central1b.releaseChannelLatestVersion?.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",
        name="test-cluster",
        location="us-central1-b",
        node_version=central1b.latest_node_version,
        initial_node_count=1)
    pulumi.export("stableChannelDefaultVersion", central1b.release_channel_default_version["STABLE"])
    pulumi.export("stableChannelLatestVersion", central1b.release_channel_latest_version["STABLE"])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v8/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{
    			Name:             pulumi.String("test-cluster"),
    			Location:         pulumi.String("us-central1-b"),
    			NodeVersion:      pulumi.String(central1b.LatestNodeVersion),
    			InitialNodeCount: pulumi.Int(1),
    		})
    		if err != nil {
    			return err
    		}
    		ctx.Export("stableChannelDefaultVersion", central1b.ReleaseChannelDefaultVersion.STABLE)
    		ctx.Export("stableChannelLatestVersion", central1b.ReleaseChannelLatestVersion.STABLE)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var central1b = Gcp.Container.GetEngineVersions.Invoke(new()
        {
            Location = "us-central1-b",
            VersionPrefix = "1.12.",
        });
    
        var foo = new Gcp.Container.Cluster("foo", new()
        {
            Name = "test-cluster",
            Location = "us-central1-b",
            NodeVersion = central1b.Apply(getEngineVersionsResult => getEngineVersionsResult.LatestNodeVersion),
            InitialNodeCount = 1,
        });
    
        return new Dictionary<string, object?>
        {
            ["stableChannelDefaultVersion"] = central1b.Apply(getEngineVersionsResult => getEngineVersionsResult.ReleaseChannelDefaultVersion?.STABLE),
            ["stableChannelLatestVersion"] = central1b.Apply(getEngineVersionsResult => getEngineVersionsResult.ReleaseChannelLatestVersion?.STABLE),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.container.ContainerFunctions;
    import com.pulumi.gcp.container.inputs.GetEngineVersionsArgs;
    import com.pulumi.gcp.container.Cluster;
    import com.pulumi.gcp.container.ClusterArgs;
    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 central1b = ContainerFunctions.getEngineVersions(GetEngineVersionsArgs.builder()
                .location("us-central1-b")
                .versionPrefix("1.12.")
                .build());
    
            var foo = new Cluster("foo", ClusterArgs.builder()
                .name("test-cluster")
                .location("us-central1-b")
                .nodeVersion(central1b.applyValue(getEngineVersionsResult -> getEngineVersionsResult.latestNodeVersion()))
                .initialNodeCount(1)
                .build());
    
            ctx.export("stableChannelDefaultVersion", central1b.applyValue(getEngineVersionsResult -> getEngineVersionsResult.releaseChannelDefaultVersion().STABLE()));
            ctx.export("stableChannelLatestVersion", central1b.applyValue(getEngineVersionsResult -> getEngineVersionsResult.releaseChannelLatestVersion().STABLE()));
        }
    }
    
    resources:
      foo:
        type: gcp:container:Cluster
        properties:
          name: test-cluster
          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:
      stableChannelDefaultVersion: ${central1b.releaseChannelDefaultVersion.STABLE}
      stableChannelLatestVersion: ${central1b.releaseChannelLatestVersion.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. See the docs on available release channel names for more details.
    ReleaseChannelLatestVersion Dictionary<string, string>
    A map from a release channel name to the channel's latest version. See the docs on available release channel names for more details.
    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. See the docs on available release channel names for more details.
    ReleaseChannelLatestVersion map[string]string
    A map from a release channel name to the channel's latest version. See the docs on available release channel names for more details.
    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. See the docs on available release channel names for more details.
    releaseChannelLatestVersion Map<String,String>
    A map from a release channel name to the channel's latest version. See the docs on available release channel names for more details.
    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. See the docs on available release channel names for more details.
    releaseChannelLatestVersion {[key: string]: string}
    A map from a release channel name to the channel's latest version. See the docs on available release channel names for more details.
    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. See the docs on available release channel names for more details.
    release_channel_latest_version Mapping[str, str]
    A map from a release channel name to the channel's latest version. See the docs on available release channel names for more details.
    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. See the docs on available release channel names for more details.
    releaseChannelLatestVersion Map<String>
    A map from a release channel name to the channel's latest version. See the docs on available release channel names for more details.
    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
    Google Cloud (GCP) Classic pulumi/pulumi-gcp
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the google-beta Terraform Provider.
    gcp logo
    Google Cloud Classic v8.3.1 published on Wednesday, Sep 25, 2024 by Pulumi