Skip to main content
IAM Roles for Service Accounts (IRSA) allows Kubernetes pods to assume AWS IAM roles directly, without needing node-level instance profiles or long-lived credentials. The EKS cluster’s OIDC provider acts as the identity token issuer; IAM verifies the token before granting the role.

How IRSA Works

1

OIDC provider is created

The module creates an aws_iam_openid_connect_provider resource backed by the EKS cluster’s OIDC issuer URL. This is enabled by default via enable_irsa = true.
2

IAM role is configured to trust the provider

You create an IAM role with a trust policy that allows the OIDC provider to assume it, scoped to a specific Kubernetes service account.
3

Service account is annotated

The Kubernetes service account is annotated with the IAM role ARN. The EKS pod identity webhook injects credentials into pods using that service account.
4

Pod receives temporary credentials

When a pod starts, it receives temporary AWS credentials via a projected volume. The AWS SDK picks these up automatically.
For new clusters, consider using EKS Pod Identity instead of IRSA. Pod Identity does not require annotating service accounts with role ARNs and simplifies the trust policy configuration.

Enabling IRSA

IRSA is enabled by default. The module creates the OIDC provider automatically when enable_irsa = true.
To disable OIDC provider creation (for example, if you manage it separately):

OIDC Provider Outputs

After applying, the module exposes the OIDC provider details as outputs:

Creating a Service Account IAM Role

Use the module outputs to build the trust policy for your service account IAM roles. The trust policy must reference the OIDC provider ARN and scope to the specific namespace and service account.
The corresponding Kubernetes service account:

Custom OIDC Audiences

By default, the OIDC provider audience is sts.amazonaws.com. Add additional client IDs (audiences) with openid_connect_audiences:

Custom OIDC Thumbprints

The module automatically retrieves the root CA thumbprint for the OIDC issuer (controlled by include_oidc_root_ca_thumbprint = true). To add additional thumbprints — for example during a certificate rotation — use custom_oidc_thumbprints:

Dual-Stack OIDC (IPv6 Clusters)

For IPv6 clusters, use the cluster_dualstack_oidc_issuer_url output instead of cluster_oidc_issuer_url to build trust policies. This URL supports both IPv4 and IPv6 clients.

IRSA Variable Reference