1. Packages
  2. AWS Classic
  3. API Docs
  4. eks
  5. getAddonVersion

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.31.0 published on Monday, Apr 15, 2024 by Pulumi

aws.eks.getAddonVersion

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.31.0 published on Monday, Apr 15, 2024 by Pulumi

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

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    export = async () => {
        const default = await aws.eks.getAddonVersion({
            addonName: "vpc-cni",
            kubernetesVersion: example.version,
        });
        const latest = await aws.eks.getAddonVersion({
            addonName: "vpc-cni",
            kubernetesVersion: example.version,
            mostRecent: true,
        });
        const vpcCni = new aws.eks.Addon("vpc_cni", {
            clusterName: example.name,
            addonName: "vpc-cni",
            addonVersion: latest.version,
        });
        return {
            "default": _default.version,
            latest: latest.version,
        };
    }
    
    import pulumi
    import pulumi_aws as aws
    
    default = aws.eks.get_addon_version(addon_name="vpc-cni",
        kubernetes_version=example["version"])
    latest = aws.eks.get_addon_version(addon_name="vpc-cni",
        kubernetes_version=example["version"],
        most_recent=True)
    vpc_cni = aws.eks.Addon("vpc_cni",
        cluster_name=example["name"],
        addon_name="vpc-cni",
        addon_version=latest.version)
    pulumi.export("default", default.version)
    pulumi.export("latest", latest.version)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/eks"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_default, err := eks.GetAddonVersion(ctx, &eks.GetAddonVersionArgs{
    			AddonName:         "vpc-cni",
    			KubernetesVersion: example.Version,
    		}, nil)
    		if err != nil {
    			return err
    		}
    		latest, err := eks.GetAddonVersion(ctx, &eks.GetAddonVersionArgs{
    			AddonName:         "vpc-cni",
    			KubernetesVersion: example.Version,
    			MostRecent:        pulumi.BoolRef(true),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = eks.NewAddon(ctx, "vpc_cni", &eks.AddonArgs{
    			ClusterName:  pulumi.Any(example.Name),
    			AddonName:    pulumi.String("vpc-cni"),
    			AddonVersion: pulumi.String(latest.Version),
    		})
    		if err != nil {
    			return err
    		}
    		ctx.Export("default", _default.Version)
    		ctx.Export("latest", latest.Version)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var @default = Aws.Eks.GetAddonVersion.Invoke(new()
        {
            AddonName = "vpc-cni",
            KubernetesVersion = example.Version,
        });
    
        var latest = Aws.Eks.GetAddonVersion.Invoke(new()
        {
            AddonName = "vpc-cni",
            KubernetesVersion = example.Version,
            MostRecent = true,
        });
    
        var vpcCni = new Aws.Eks.Addon("vpc_cni", new()
        {
            ClusterName = example.Name,
            AddonName = "vpc-cni",
            AddonVersion = latest.Apply(getAddonVersionResult => getAddonVersionResult.Version),
        });
    
        return new Dictionary<string, object?>
        {
            ["default"] = @default.Apply(@default => @default.Apply(getAddonVersionResult => getAddonVersionResult.Version)),
            ["latest"] = latest.Apply(getAddonVersionResult => getAddonVersionResult.Version),
        };
    });
    
    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 default = EksFunctions.getAddonVersion(GetAddonVersionArgs.builder()
                .addonName("vpc-cni")
                .kubernetesVersion(example.version())
                .build());
    
            final var latest = EksFunctions.getAddonVersion(GetAddonVersionArgs.builder()
                .addonName("vpc-cni")
                .kubernetesVersion(example.version())
                .mostRecent(true)
                .build());
    
            var vpcCni = new Addon("vpcCni", AddonArgs.builder()        
                .clusterName(example.name())
                .addonName("vpc-cni")
                .addonVersion(latest.applyValue(getAddonVersionResult -> getAddonVersionResult.version()))
                .build());
    
            ctx.export("default", default_.version());
            ctx.export("latest", latest.applyValue(getAddonVersionResult -> getAddonVersionResult.version()));
        }
    }
    
    resources:
      vpcCni:
        type: aws:eks:Addon
        name: vpc_cni
        properties:
          clusterName: ${example.name}
          addonName: vpc-cni
          addonVersion: ${latest.version}
    variables:
      default:
        fn::invoke:
          Function: aws:eks:getAddonVersion
          Arguments:
            addonName: vpc-cni
            kubernetesVersion: ${example.version}
      latest:
        fn::invoke:
          Function: aws:eks:getAddonVersion
          Arguments:
            addonName: vpc-cni
            kubernetesVersion: ${example.version}
            mostRecent: true
    outputs:
      default: ${default.version}
      latest: ${latest.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
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.31.0 published on Monday, Apr 15, 2024 by Pulumi