terraform-aws-modules / terraform-aws-iam

Terraform module to create AWS IAM resources 🇺🇦
https://registry.terraform.io/modules/terraform-aws-modules/iam/aws
Apache License 2.0
787 stars 997 forks source link

Could not download modul #521

Closed senad-d closed 2 weeks ago

senad-d commented 2 weeks ago

Description

Please provide a clear and concise description of the issue you are encountering, and a reproduction of your configuration (see the examples/* directory for references that you can copy+paste and tailor to match your configs if you are unable to copy your exact configuration). The reproduction MUST be executable by running terraform init && terraform apply without any further changes.

If your request is for a new feature, please use the Feature request template.

⚠️ Note

Before you submit an issue, please perform the following first:

  1. Remove the local .terraform directory (! ONLY if state is stored remotely, which hopefully you are following that best practice!): rm -rf .terraform/
  2. Re-initialize the project root to pull down modules: terraform init
  3. Re-attempt your terraform plan or apply and check if the issue still persists

Versions

Reproduction Code [Required]

On terraform init: Error: Unreadable module directory

The directory .terraform/modules/iam_github_oidc_provider/modules/iam-github-oidc-provider could not be read. This is a bug in Terraform and should be reported.

Steps to reproduce the behavior:

Expected behavior

Download module

Actual behavior

Can't download module

Terminal Output Screenshot(s)

image

Additional context

antonbabenko commented 2 weeks ago

"This is a bug in Terraform and should be reported" - the error says, but actually please make sure that you specify the source with double slashes in the address and run "rm -rf .terraform" before running it:

module "iam_github_oidc_provider" {
  source    = "terraform-aws-modules/iam/aws//modules/iam-github-oidc-provider"

  tags = {
    Environment = "test"
  }
}
senad-d commented 2 weeks ago

The problem is with dubious ownership in repository. I need to permit the download from the source by adding git config --global --add safe.directory.

$ git config --global --add safe.directory <path/to/directory>/.terraform/modules/iam_github_oidc_provider
$ git config --global --add safe.directory <path/to/directory>/.terraform/modules/iam_github_oidc_role /app/source/github-openid/.terraform/modules/iam_github_oidc_role
image