Retrieves information about specific EKS add-on versions compatible with an EKS cluster version and deploys an add-on.

Terraform Template

data "aws_eks_addon_version" "default" {
  addon_name = "vpc-cni"
  kubernetes_version = "aws_eks_cluster.example.version"
}

data "aws_eks_addon_version" "latest" {
  addon_name = "vpc-cni"
  kubernetes_version = "aws_eks_cluster.example.version"
  most_recent = true
}

resource "aws_eks_addon" "vpc_cni" {
  addon_name = "vpc-cni"
  addon_version = data.aws_eks_addon_version.latest.version
  cluster_name = "aws_eks_cluster.example.name"
}

output "default" {
  value = data.aws_eks_addon_version.default.version
}

output "latest" {
  value = data.aws_eks_addon_version.latest.version
}