AWS Classic

v5.16.0 published on Saturday, Sep 24, 2022 by Pulumi

getAddonVersion

Retrieve information about a specific EKS add-on version compatible with an EKS cluster version.

Example Usage

using System.Collections.Generic;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var defaultAddonVersion = Aws.Eks.GetAddonVersion.Invoke(new()
    {
        AddonName = "vpc-cni",
        KubernetesVersion = aws_eks_cluster.Example.Version,
    });

    var latestAddonVersion = Aws.Eks.GetAddonVersion.Invoke(new()
    {
        AddonName = "vpc-cni",
        KubernetesVersion = aws_eks_cluster.Example.Version,
        MostRecent = true,
    });

    var vpcCni = new Aws.Eks.Addon("vpcCni", new()
    {
        ClusterName = aws_eks_cluster.Example.Name,
        AddonName = "vpc-cni",
        AddonVersion = latestAddonVersion.Apply(getAddonVersionResult => getAddonVersionResult.Version),
    });

    return new Dictionary<string, object?>
    {
        ["default"] = defaultAddonVersion.Apply(getAddonVersionResult => getAddonVersionResult.Version),
        ["latest"] = latestAddonVersion.Apply(getAddonVersionResult => getAddonVersionResult.Version),
    };
});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/eks"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		defaultAddonVersion, err := eks.GetAddonVersion(ctx, &eks.GetAddonVersionArgs{
			AddonName:         "vpc-cni",
			KubernetesVersion: aws_eks_cluster.Example.Version,
		}, nil)
		if err != nil {
			return err
		}
		latestAddonVersion, err := eks.GetAddonVersion(ctx, &eks.GetAddonVersionArgs{
			AddonName:         "vpc-cni",
			KubernetesVersion: aws_eks_cluster.Example.Version,
			MostRecent:        pulumi.BoolRef(true),
		}, nil)
		if err != nil {
			return err
		}
		_, err = eks.NewAddon(ctx, "vpcCni", &eks.AddonArgs{
			ClusterName:  pulumi.Any(aws_eks_cluster.Example.Name),
			AddonName:    pulumi.String("vpc-cni"),
			AddonVersion: pulumi.String(latestAddonVersion.Version),
		})
		if err != nil {
			return err
		}
		ctx.Export("default", defaultAddonVersion.Version)
		ctx.Export("latest", latestAddonVersion.Version)
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.eks.EksFunctions;
import com.pulumi.aws.eks.inputs.GetAddonVersionArgs;
import com.pulumi.aws.eks.Addon;
import com.pulumi.aws.eks.AddonArgs;
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 defaultAddonVersion = EksFunctions.getAddonVersion(GetAddonVersionArgs.builder()
            .addonName("vpc-cni")
            .kubernetesVersion(aws_eks_cluster.example().version())
            .build());

        final var latestAddonVersion = EksFunctions.getAddonVersion(GetAddonVersionArgs.builder()
            .addonName("vpc-cni")
            .kubernetesVersion(aws_eks_cluster.example().version())
            .mostRecent(true)
            .build());

        var vpcCni = new Addon("vpcCni", AddonArgs.builder()        
            .clusterName(aws_eks_cluster.example().name())
            .addonName("vpc-cni")
            .addonVersion(latestAddonVersion.applyValue(getAddonVersionResult -> getAddonVersionResult.version()))
            .build());

        ctx.export("default", defaultAddonVersion.applyValue(getAddonVersionResult -> getAddonVersionResult.version()));
        ctx.export("latest", latestAddonVersion.applyValue(getAddonVersionResult -> getAddonVersionResult.version()));
    }
}
import pulumi
import pulumi_aws as aws

default_addon_version = aws.eks.get_addon_version(addon_name="vpc-cni",
    kubernetes_version=aws_eks_cluster["example"]["version"])
latest_addon_version = aws.eks.get_addon_version(addon_name="vpc-cni",
    kubernetes_version=aws_eks_cluster["example"]["version"],
    most_recent=True)
vpc_cni = aws.eks.Addon("vpcCni",
    cluster_name=aws_eks_cluster["example"]["name"],
    addon_name="vpc-cni",
    addon_version=latest_addon_version.version)
pulumi.export("default", default_addon_version.version)
pulumi.export("latest", latest_addon_version.version)
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

export = async () => {
    const defaultAddonVersion = await aws.eks.getAddonVersion({
        addonName: "vpc-cni",
        kubernetesVersion: aws_eks_cluster.example.version,
    });
    const latestAddonVersion = await aws.eks.getAddonVersion({
        addonName: "vpc-cni",
        kubernetesVersion: aws_eks_cluster.example.version,
        mostRecent: true,
    });
    const vpcCni = new aws.eks.Addon("vpcCni", {
        clusterName: aws_eks_cluster.example.name,
        addonName: "vpc-cni",
        addonVersion: latestAddonVersion.version,
    });
    const _default = defaultAddonVersion.version;
    const latest = latestAddonVersion.version;
    return {
        "default": _default,
        latest: latest,
    };
}
resources:
  vpcCni:
    type: aws:eks:Addon
    properties:
      clusterName: ${aws_eks_cluster.example.name}
      addonName: vpc-cni
      addonVersion: ${latestAddonVersion.version}
variables:
  defaultAddonVersion:
    Fn::Invoke:
      Function: aws:eks:getAddonVersion
      Arguments:
        addonName: vpc-cni
        kubernetesVersion: ${aws_eks_cluster.example.version}
  latestAddonVersion:
    Fn::Invoke:
      Function: aws:eks:getAddonVersion
      Arguments:
        addonName: vpc-cni
        kubernetesVersion: ${aws_eks_cluster.example.version}
        mostRecent: true
outputs:
  default: ${defaultAddonVersion.version}
  latest: ${latestAddonVersion.version}

Using getAddonVersion

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 getAddonVersion(args: GetAddonVersionArgs, opts?: InvokeOptions): Promise<GetAddonVersionResult>
function getAddonVersionOutput(args: GetAddonVersionOutputArgs, opts?: InvokeOptions): Output<GetAddonVersionResult>
def get_addon_version(addon_name: Optional[str] = None,
                      kubernetes_version: Optional[str] = None,
                      most_recent: Optional[bool] = None,
                      opts: Optional[InvokeOptions] = None) -> GetAddonVersionResult
def get_addon_version_output(addon_name: Optional[pulumi.Input[str]] = None,
                      kubernetes_version: Optional[pulumi.Input[str]] = None,
                      most_recent: Optional[pulumi.Input[bool]] = None,
                      opts: Optional[InvokeOptions] = None) -> Output[GetAddonVersionResult]
func GetAddonVersion(ctx *Context, args *GetAddonVersionArgs, opts ...InvokeOption) (*GetAddonVersionResult, error)
func GetAddonVersionOutput(ctx *Context, args *GetAddonVersionOutputArgs, opts ...InvokeOption) GetAddonVersionResultOutput

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

public static class GetAddonVersion 
{
    public static Task<GetAddonVersionResult> InvokeAsync(GetAddonVersionArgs args, InvokeOptions? opts = null)
    public static Output<GetAddonVersionResult> Invoke(GetAddonVersionInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetAddonVersionResult> getAddonVersion(GetAddonVersionArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: aws:eks/getAddonVersion:getAddonVersion
  Arguments:
    # Arguments dictionary

The following arguments are supported:

AddonName string

Name of the EKS add-on. The name must match one of the names returned by list-addon.

KubernetesVersion string

Version of the EKS Cluster. Must be between 1-100 characters in length. Must begin with an alphanumeric character, and must only contain alphanumeric characters, dashes and underscores (^[0-9A-Za-z][A-Za-z0-9\-_]+$).

MostRecent bool

Determines if the most recent or default version of the addon should be returned.

AddonName string

Name of the EKS add-on. The name must match one of the names returned by list-addon.

KubernetesVersion string

Version of the EKS Cluster. Must be between 1-100 characters in length. Must begin with an alphanumeric character, and must only contain alphanumeric characters, dashes and underscores (^[0-9A-Za-z][A-Za-z0-9\-_]+$).

MostRecent bool

Determines if the most recent or default version of the addon should be returned.

addonName String

Name of the EKS add-on. The name must match one of the names returned by list-addon.

kubernetesVersion String

Version of the EKS Cluster. Must be between 1-100 characters in length. Must begin with an alphanumeric character, and must only contain alphanumeric characters, dashes and underscores (^[0-9A-Za-z][A-Za-z0-9\-_]+$).

mostRecent Boolean

Determines if the most recent or default version of the addon should be returned.

addonName string

Name of the EKS add-on. The name must match one of the names returned by list-addon.

kubernetesVersion string

Version of the EKS Cluster. Must be between 1-100 characters in length. Must begin with an alphanumeric character, and must only contain alphanumeric characters, dashes and underscores (^[0-9A-Za-z][A-Za-z0-9\-_]+$).

mostRecent boolean

Determines if the most recent or default version of the addon should be returned.

addon_name str

Name of the EKS add-on. The name must match one of the names returned by list-addon.

kubernetes_version str

Version of the EKS Cluster. Must be between 1-100 characters in length. Must begin with an alphanumeric character, and must only contain alphanumeric characters, dashes and underscores (^[0-9A-Za-z][A-Za-z0-9\-_]+$).

most_recent bool

Determines if the most recent or default version of the addon should be returned.

addonName String

Name of the EKS add-on. The name must match one of the names returned by list-addon.

kubernetesVersion String

Version of the EKS Cluster. Must be between 1-100 characters in length. Must begin with an alphanumeric character, and must only contain alphanumeric characters, dashes and underscores (^[0-9A-Za-z][A-Za-z0-9\-_]+$).

mostRecent Boolean

Determines if the most recent or default version of the addon should be returned.

getAddonVersion Result

The following output properties are available:

AddonName string
Id string

The provider-assigned unique ID for this managed resource.

KubernetesVersion string
Version string

Version of the EKS add-on.

MostRecent bool
AddonName string
Id string

The provider-assigned unique ID for this managed resource.

KubernetesVersion string
Version string

Version of the EKS add-on.

MostRecent bool
addonName String
id String

The provider-assigned unique ID for this managed resource.

kubernetesVersion String
version String

Version of the EKS add-on.

mostRecent Boolean
addonName string
id string

The provider-assigned unique ID for this managed resource.

kubernetesVersion string
version string

Version of the EKS add-on.

mostRecent boolean
addon_name str
id str

The provider-assigned unique ID for this managed resource.

kubernetes_version str
version str

Version of the EKS add-on.

most_recent bool
addonName String
id String

The provider-assigned unique ID for this managed resource.

kubernetesVersion String
version String

Version of the EKS add-on.

mostRecent Boolean

Package Details

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

This Pulumi package is based on the aws Terraform Provider.