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 theexamples/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
The name of the EKS cluster. Used to scope IAM policy conditions and name SQS/EventBridge resources.
Create a dedicated node IAM role. Set to
false when re-using an existing role (e.g. from an EKS managed node group).ARN of an existing node IAM role. Required when
create_node_iam_role = false.Additional managed policies to attach to the node IAM role. A common addition is
AmazonSSMManagedInstanceCore to enable SSM Session Manager access to Karpenter nodes.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).Create an EKS Pod Identity association that links the Karpenter service account to the controller IAM role.
Kubernetes namespace for the Karpenter Pod Identity association.
Kubernetes service account name for the Karpenter Pod Identity association.
Create the SQS queue and EventBridge rules for native spot interruption and capacity rebalancing handling.
Override the auto-generated SQS queue name. Defaults to the cluster name.
Use
node_iam_role_name as a name prefix. Set to false when the Karpenter EC2NodeClass references the role by its exact name.Tags applied to all resources created by this module.
Key outputs
| Output | Description |
|---|---|
iam_role_arn | ARN of the Karpenter controller IAM role |
iam_role_name | Name of the Karpenter controller IAM role |
node_iam_role_arn | ARN of the node IAM role used by Karpenter-provisioned instances |
node_iam_role_name | Name of the node IAM role |
queue_name | Name of the SQS interruption queue — pass to settings.interruptionQueue in the Helm values |
queue_arn | ARN of the SQS interruption queue |
queue_url | URL of the SQS interruption queue |
instance_profile_arn | ARN of the IAM instance profile (only populated when create_instance_profile = true) |
node_access_entry_arn | ARN of the EKS access entry created for the node IAM role |
event_rules | Map of EventBridge rule attributes |
namespace | Namespace associated with the Pod Identity |
service_account | Service account associated with the Pod Identity |
Resources created
IAM (controller)
IAM (controller)
aws_iam_role.controller— controller IAM role with Pod Identity trust policyaws_iam_policy.controller— scoped Karpenter controller policy (EC2, SQS, SSM, etc.)aws_iam_role_policy_attachment.controller— attaches the policy to the roleaws_eks_pod_identity_association.karpenter— links the Karpenter service account to the controller role
IAM (node)
IAM (node)
aws_iam_role.node— node IAM role (EC2 trust policy)aws_iam_role_policy_attachment.node— attachesAmazonEKSWorkerNodePolicy,AmazonEC2ContainerRegistryReadOnly, and optionally the CNI policyaws_iam_instance_profile.this— instance profile (created whencreate_instance_profile = true)aws_eks_access_entry.node— EKS access entry of typeEC2_LINUX
Interruption handling
Interruption handling
aws_sqs_queue.this— SQS queue for interruption eventsaws_sqs_queue_policy.this— queue resource policy allowing EventBridge to send messagesaws_cloudwatch_event_rule.this— EventBridge rules for spot interruption, capacity rebalancing, instance state changes, and scheduled changesaws_cloudwatch_event_target.this— routes each rule to the SQS queue
