Skip to main content
The karpenter sub-module creates the AWS-side resources that Karpenter requires to function. It does not install the Karpenter controller itself — that is done separately via Helm.

Controller IAM Role

An IAM role scoped to the Karpenter controller, together with a Pod Identity association so the controller pod can assume it without IRSA.

Node IAM Role

A node IAM role (and optional instance profile) that Karpenter uses when provisioning new EC2 nodes. An EKS access entry is created so those nodes can join the cluster automatically.

SQS Interruption Queue

An SQS queue that Karpenter monitors for EC2 spot interruption notices, capacity rebalancing events, and instance state-change notifications.

EventBridge Rules

EventBridge rules that route AWS-generated lifecycle events to the SQS queue, enabling Karpenter’s native interruption handling.

Usage

Default — all resources

Create every resource in a single call. Karpenter will get its own node IAM role and an access entry will be registered on the cluster.

Re-use an existing node IAM role

When you already have an EKS managed node group, you can point Karpenter at that group’s IAM role to avoid creating a duplicate. Disable access entry creation because the node group already has one.

Full production example (with Helm install)

This is taken from the examples/karpenter directory in the module source. It shows how all pieces fit together — the EKS cluster, Karpenter sub-module, and the Helm release.
The eks-pod-identity-agent addon must be installed (before_compute = true) for the Pod Identity association to work. Without it the Karpenter controller pod cannot assume its IAM role.

Key inputs

string
required
The name of the EKS cluster. Used to scope IAM policy conditions and name SQS/EventBridge resources.
bool
default:"true"
Create a dedicated node IAM role. Set to false when re-using an existing role (e.g. from an EKS managed node group).
string
ARN of an existing node IAM role. Required when create_node_iam_role = false.
map(string)
default:"{}"
Additional managed policies to attach to the node IAM role. A common addition is AmazonSSMManagedInstanceCore to enable SSM Session Manager access to Karpenter nodes.
bool
default:"true"
Register an EKS access entry for the node IAM role so that Karpenter-provisioned nodes can join the cluster. Set to false when the role already has an access entry (e.g. shared with a managed node group).
bool
default:"true"
Create an EKS Pod Identity association that links the Karpenter service account to the controller IAM role.
string
default:"kube-system"
Kubernetes namespace for the Karpenter Pod Identity association.
string
default:"karpenter"
Kubernetes service account name for the Karpenter Pod Identity association.
bool
default:"true"
Create the SQS queue and EventBridge rules for native spot interruption and capacity rebalancing handling.
string
Override the auto-generated SQS queue name. Defaults to the cluster name.
bool
default:"true"
Use node_iam_role_name as a name prefix. Set to false when the Karpenter EC2NodeClass references the role by its exact name.
map(string)
default:"{}"
Tags applied to all resources created by this module.

Key outputs

Resources created

  • aws_iam_role.controller — controller IAM role with Pod Identity trust policy
  • aws_iam_policy.controller — scoped Karpenter controller policy (EC2, SQS, SSM, etc.)
  • aws_iam_role_policy_attachment.controller — attaches the policy to the role
  • aws_eks_pod_identity_association.karpenter — links the Karpenter service account to the controller role
  • aws_iam_role.node — node IAM role (EC2 trust policy)
  • aws_iam_role_policy_attachment.node — attaches AmazonEKSWorkerNodePolicy, AmazonEC2ContainerRegistryReadOnly, and optionally the CNI policy
  • aws_iam_instance_profile.this — instance profile (created when create_instance_profile = true)
  • aws_eks_access_entry.node — EKS access entry of type EC2_LINUX
  • aws_sqs_queue.this — SQS queue for interruption events
  • aws_sqs_queue_policy.this — queue resource policy allowing EventBridge to send messages
  • aws_cloudwatch_event_rule.this — EventBridge rules for spot interruption, capacity rebalancing, instance state changes, and scheduled changes
  • aws_cloudwatch_event_target.this — routes each rule to the SQS queue
If you set create_node_iam_role = false and create_access_entry = false, you are responsible for ensuring the provided node_iam_role_arn already has a valid EC2_LINUX access entry on the cluster. Karpenter nodes will not be able to join without it.