Skip to content

Commit

Permalink
fix: Use eks module for access_entries for trn-inf blueprint (#646)
Browse files Browse the repository at this point in the history
  • Loading branch information
askulkarni2 authored Sep 11, 2024
1 parent e629d1d commit 26d8db3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 26 deletions.
29 changes: 3 additions & 26 deletions ai-ml/trainium-inferentia/addons.tf
Original file line number Diff line number Diff line change
Expand Up @@ -222,33 +222,10 @@ module "eks_blueprints_addons" {
tags = local.tags
}

# Access Entries
locals {
# Default access entry
karpenter_access_entry = {
karpenter = {
principal_arn = module.eks_blueprints_addons.karpenter.node_iam_role_arn
type = "EC2_LINUX"
}
}

# Merge var.access_entries with the karpenter_access_entry
merged_access_entries = merge(
local.karpenter_access_entry,
var.access_entries
)
}

resource "aws_eks_access_entry" "this" {
for_each = local.merged_access_entries

cluster_name = module.eks.cluster_name
kubernetes_groups = try(each.value.kubernetes_groups, null)
principal_arn = each.value.principal_arn
type = try(each.value.type, "STANDARD")
user_name = try(each.value.user_name, null)

tags = merge(try(each.value.tags, {}))
cluster_name = module.eks.cluster_name
principal_arn = module.eks_blueprints_addons.karpenter.node_iam_role_arn
type = "EC2_LINUX"
}

#---------------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions ai-ml/trainium-inferentia/eks.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ module "eks" {
# allow deploying resources (Karpenter) into the cluster
enable_cluster_creator_admin_permissions = true

access_entries = var.access_entries

vpc_id = module.vpc.vpc_id
# Filtering only Secondary CIDR private subnets starting with "100.". Subnet IDs where the EKS Control Plane ENIs will be created
subnet_ids = compact([for subnet_id, cidr_block in zipmap(module.vpc.private_subnets, module.vpc.private_subnets_cidr_blocks) :
Expand Down

0 comments on commit 26d8db3

Please sign in to comment.