clowdhaus / terraform-aws-eks-migrate-v19-to-v20

What it says on the tin
5 stars 2 forks source link

fix: Update the access entry creation to latest from the parent repo #2

Closed justincbeard closed 7 months ago

justincbeard commented 7 months ago

Description

Update the access entry creation to latest from the parent repo so entries without policy_associations work (e.g. when type is "EC2_LINUX")

Motivation and Context

Access Entries that are defined only get populated if the policy_associations block is defined. This is due to the to looping over the local.flattened_access_entries to create the aws_eks_access_entry resources. This was fixed in the parent module repo in this PR and I think it should be ported here for anyone that is doing the migration from v19.21.0 to v20.0.0

I discovered the problem when trying to add an entry for our Karpenter instances (which we manage outside of the EKS module). Adding a similar block like this to the access_entries parameter had no affect.

access_entries = {
  karpenter_nodes = {
    kubernetes_groups = ["system:nodes"]
    policy_associations = {}
    principal_arn = "arn:aws:iam::012345678901:role/karpenter-node"
    type = "EC2_LINUX"
  }
}

How Has This Been Tested?

I forked this repo and copied the needed changes into main.tf then updated the module source in the my terraform code. I was able to create an access entry that used type "EC2_LINUX" and a blank policy association.