Skip to content

Commit

Permalink
AWS vpc-cni custom networking fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nerahou committed Apr 22, 2024
1 parent fb53a09 commit 8507bad
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,21 @@ EOF
}
}

resource "null_resource" "enable_custom_networking" {
count = var.handle_eni_configs ? 1 : 0
provisioner "local-exec" {
command = <<EOF
aws eks update-addon \
--region ${data.aws_region.current.name} \
--cluster-name ${var.cluster_name} \
--addon-name vpc-cni \
--configuration-values '{"env": {"AWS_VPC_K8S_CNI_CUSTOM_NETWORK_CFG": "true"}}' \
--resolve-conflicts "OVERWRITE"
EOF
}
}

resource "aws_security_group" "remote_access" {
# Create this security group only if remote access is requested
count = var.remote_access_ssh_key != null ? 1 : 0
Expand Down Expand Up @@ -278,7 +293,7 @@ resource "aws_cloudwatch_log_group" "cluster_logs" {
}

resource "helm_release" "eni_configs" {
count = var.handle_eni_configs && try(var.cluster_addons["vpc-cni"].enabled, false) ? 1 : 0
count = var.handle_eni_configs ? 1 : 0
version = "1.0.0"
chart = "empty"
repository = "https://quortex.github.io/helm-charts"
Expand All @@ -289,5 +304,5 @@ resource "helm_release" "eni_configs" {
eniConfigs : jsonencode(local.eni_configs)
})
]
depends_on = [aws_eks_addon.quortex_addon["vpc-cni"]]
depends_on = [aws_eks_addon.quortex_addon]
}

0 comments on commit 8507bad

Please sign in to comment.