Why am I getting an "Unreadable module directory" error with the IAM GitHub OIDC role module?

Last updated: September 9, 2025

Context

When using the terraform-aws-modules/iam GitHub OIDC role module without a pinned version, users may encounter an "Unreadable module directory" error. This error appears when trying to access the module directory, particularly with paths containing duplicate module references.

Answer

This error occurs because the IAM GitHub OIDC role module was removed in version 6.0 of the terraform-aws-modules/iam package. To resolve this issue:

  1. Pin your module version to a release prior to version 6.0 by adding a version constraint in your module block. For example:

``` module "iam_github_oidc_role" { source = "terraform-aws-modules/iam/aws//modules/iam-github-oidc-role" version = "~> 5.0" # This ensures using a version below 6.0 } ```

Source: terraform-aws-modules/terraform-aws-iam releases