Skip to content

Commit

Permalink
Explicitly set the default addon version (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelhar authored Sep 11, 2023
1 parent aeb0a8e commit e4f0627
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions submodules/eks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
| [aws_caller_identity.aws_account](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
| [aws_caller_identity.aws_eks_provider](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
| [aws_ec2_instance_type_offerings.nodes](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ec2_instance_type_offerings) | data source |
| [aws_eks_addon_version.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/eks_addon_version) | data source |
| [aws_iam_policy_document.autoscaler](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_iam_policy_document.custom_eks_node_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_iam_policy_document.ebs_csi](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
Expand Down
12 changes: 10 additions & 2 deletions submodules/eks/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,18 @@ resource "aws_iam_openid_connect_provider" "oidc_provider" {
}


data "aws_eks_addon_version" "default" {
for_each = toset(concat(["vpc-cni"], var.eks.cluster_addons))
addon_name = each.key
kubernetes_version = aws_eks_cluster.this.version
}

resource "aws_eks_addon" "vpc_cni" {
cluster_name = aws_eks_cluster.this.name
addon_name = "vpc-cni"
addon_version = data.aws_eks_addon_version.default["vpc-cni"].version
resolve_conflicts_on_create = "OVERWRITE"
resolve_conflicts_on_update = "OVERWRITE"
addon_name = "vpc-cni"
configuration_values = jsonencode({
env = merge(
{},
Expand All @@ -101,9 +108,10 @@ resource "aws_eks_addon" "vpc_cni" {
resource "aws_eks_addon" "this" {
for_each = toset(var.eks.cluster_addons)
cluster_name = aws_eks_cluster.this.name
addon_name = each.key
addon_version = data.aws_eks_addon_version.default[each.key].version
resolve_conflicts_on_create = "OVERWRITE"
resolve_conflicts_on_update = "OVERWRITE"
addon_name = each.key

depends_on = [
aws_eks_node_group.node_groups,
Expand Down

0 comments on commit e4f0627

Please sign in to comment.