eks_managed_node_groups map works with different operating systems.
Prerequisites
- AWS credentials with permissions to create EKS, EC2, IAM, and VPC resources
- Terraform >= 1.5.7
- AWS provider >= 6.28
- The example provisions its own VPC — no pre-existing VPC is required
VPC and shared locals
Both clusters share a common VPC defined inmain.tf.
Amazon Linux 2023 cluster (eks-al2023.tf)
AL2023 is the default AMI type for EKS managed node groups starting with Kubernetes 1.30. It uses nodeadm for node initialization, and additional configuration can be injected via cloudinit_pre_nodeadm.
Bottlerocket cluster (eks-bottlerocket.tf)
Bottlerocket is a Linux-based OS purpose-built for container workloads. Node configuration is injected via the bootstrap_extra_args field using TOML syntax.
Key configuration options
AMI types
before_compute addon flag
Setting before_compute = true on vpc-cni and eks-pod-identity-agent ensures those addons are installed before the first node joins the cluster, preventing race conditions where pods start before the CNI is ready.
desired_size and drift
desired_size is only respected on the initial creation of the node group. After creation, the Auto Scaling group’s actual desired capacity is the source of truth. See eks-desired-size-hack for a workaround pattern.
Deploy
1
Initialize Terraform
2
Review the plan
3
Apply
Both clusters are created together. Expect 15–20 minutes for all resources.
4
Configure kubectl
Key outputs
Full example on GitHub
View the complete example includingoutputs.tf, variables.tf, and versions.tf.