$ show terraform-aws-modules/terraform-aws-eks
This repository is a comprehensive Terraform module for provisioning and managing AWS EKS (Elastic Kubernetes Service) clusters. It provides a modular, production-grade interface to create clusters with all supporting resources: IAM roles, security groups, VPC networking, encryption (KMS), logging, addons, identity providers (OIDC/IRSA), and access entries. The root module orchestrates multiple sub-modules for compute resources including EKS managed node groups, self-managed node groups (autoscaling groups), Fargate profiles, Karpenter integration, hybrid node roles, and EKS capabilities (ACK, ArgoCD, KRO). The architecture follows standard Terraform module patterns with extensive use of `for_each`, `dynamic` blocks, and conditional creation. The codebase demonstrates high craftsmanship through its modular design, comprehensive test infrastructure, and detailed upgrade guides that document breaking changes across major versions (v17 through v21). It includes an internal user data rendering sub-module that supports AL2, AL2023, Bottlerocket, and Windows AMIs, with both cloud-init and custom template support.
The LLM identified 3 files worth highlighting for reuse:
Provides a turnkey integration for Karpenter autoscaler on EKS. Creates the controller IAM role, node IAM role with instance profile, SQS queue for node termination events, and EventBridge rules to capture spot/interruption/termination events. Uses for_each to manage multiple policy attachments and supports pod identity association. Reusable for any EKS cluster requiring Karpenter with minimal adaptation.
Internal module that renders OS-specific user data (bootstrap scripts) for multiple AMI families: AL2, AL2023, Bottlerocket, and Windows. Supports pre/post nodeadm (AL2023 cloud-init), bootstrap extra args, custom template overrides, and both EKS managed and self-managed bootstrap types. Encapsulates the complex conditional rendering logic and can be extracted for use in other projects that need to generate EKS bootstrap scripts.
Creates a fully configurable self-managed node group using an Auto Scaling group with launch template. Supports mixed instances policies, spot instances, EFA networking with automatic network interface generation, placement groups, detailed IAM instance profiles, and custom user data. Uses dynamic blocks to flatten optional configurations and conditional resource creation. Demonstrates a robust pattern for AWS autoscaling group orchestration that can be reused for other services.