4

Executing "terragrunt plan" from Visual Studio code gives the below error in Windows 10:

Running command: terraform init -backend-config=region=eu-west-2 -backend-config=bucket=bucket-name" -backend-config=dynamodb_table=lock-table -backend-config=encrypt=true -backend-config=key=ec2/terraform.tfstate

Initializing the backend...

Successfully configured the backend "s3"! Terraform will automatically use this backend unless the backend configuration changes.

Initializing provider plugins...

  • Finding hashicorp/aws versions matching "~> 3.36.0"...
  • Installing hashicorp/aws v3.36.0...

Error: Failed to install provider

Error while installing hashicorp/aws v3.36.0: mkdir .terraform/plugins/registry.terraform.io/hashicorp/aws/3.36.0/windows_amd64: The filename or extension is too long.

[terragrunt] 2021/05/19 15:39:20 Hit multiple errors: exit status 1

Vamshee Akula
  • 41
  • 1
  • 2

4 Answers4

3

Thanks Rubens for suggesting using TERRAGRUNT_DOWNLOAD environment variable. I'm able to work around this problem.

Here are the complete steps in terragrunt:

  1. from cmd, set TERRAGRUNT_DOWNLOAD and call init:
set TERRAGRUNT_DOWNLOAD=C:\\.terragrunt-cache

terragrunt init
  1. Then copy or move C:\\.terragrunt-cache content to the .terragrunt-cache in my project (better clean up the folder first)

  2. from cmd, unset TERRAGRUNT_DOWNLOAD and call apply

set TERRAGRUNT_DOWNLOAD=

terragrunt apply
Tyler2P
  • 2,324
  • 26
  • 22
  • 31
1

Had this problem today and I solved by creating a TERRAGRUNT_DOWNLOAD environment variable.

I set the value to TERRAGRUNT_DOWNLOAD=C:\.terragrunt-cache.

Got this solution from this issue https://github.com/gruntwork-io/terragrunt/issues/581#issuecomment-460051767

  • This worked! Thank you. Was able to test this using: `TERRAGRUNT_DOWNLOAD=C:\.terragrunt-cache terraform init` – tjheslin1 Nov 25 '21 at 10:48
1

The proper fix is here:

  1. Start Git Bash as Administrator
  2. Run command git config --system core.longpaths true

How to fix "Filename too long error" during git clone

Rexxo
  • 156
  • 3
  • 16
-1

I had faced similar issue on terraform init. I installed latest version of terraform and it got resolved.

Tarun Reddy
  • 2,123
  • 2
  • 11
  • 6