gruntwork-io / terragrunt

Terragrunt is a flexible orchestration tool that allows Infrastructure as Code written in OpenTofu/Terraform to scale.
https://terragrunt.gruntwork.io/
MIT License
8.09k stars 981 forks source link

Terragrunt catalog returns git error after second download #3406

Closed Fauzyy closed 2 months ago

Fauzyy commented 2 months ago

Describe the bug

Running terragrunt catalog on a git url will result in a git error after running it a second time:

fatal: empty string is not a valid pathspec. please use . instead if you meant to match all paths

This error goes away after deleting the tmp dir which terragrunt clones the module to

Steps To Reproduce

  1. Run terragrunt catalog <module-src-url>
    ❯ GIT_CURL_VERBOSE=1 GIT_TRACE=1 terragrunt catalog https://github.com/terraform-aws-modules/terraform-aws-vpc
    11:09:10.477 INFO   Cloning repository "git::https://github.com/terraform-aws-modules/terraform-aws-vpc.git" to temporary directory "/var/folders/80/8xwm4m4n2yg9qy8l8kmjng0m0000gn/T/catalog764e715034557a556b35447a4b64396a306a496773364638307738/terraform-aws-vpc"
    11:09:14.376 INFO   Found 2 modules in repository "https://github.com/terraform-aws-modules/terraform-aws-vpc"
  2. Run the same command again
    
    ❯ GIT_CURL_VERBOSE=1 GIT_TRACE=1 terragrunt catalog https://github.com/terraform-aws-modules/terraform-aws-vpc
    11:09:33.017 INFO   Cloning repository "git::https://github.com/terraform-aws-modules/terraform-aws-vpc.git" to temporary directory "/var/folders/80/8xwm4m4n2yg9qy8l8kmjng0m0000gn/T/catalog764e715034557a556b35447a4b64396a306a496773364638307738/terraform-aws-vpc"
    11:09:36.916 ERROR  error downloading 'https://github.com/terraform-aws-modules/terraform-aws-vpc.git': /opt/homebrew/bin/git exited with 128: 11:09:36.912892 git.c:472               trace: built-in: git checkout ''
    fatal: empty string is not a valid pathspec. please use . instead if you meant to match all paths

11:09:36.916 ERROR Unable to determine underlying exit code, so Terragrunt will exit with error code 1


Workaround is to remove the tmp dir every time you run the command:

rm -rf /var/folders/80/8xwm4m4n2yg9qy8l8kmjng0m0000gn/T/catalog764e715034557a556b35447a4b64396a306a496773364638307738/terraform-aws-vpc



## Expected behavior

`terragrunt catalog` should be able to run consecutively with no errors

## Versions

- Terragrunt version: 0.67.4
- OpenTofu/Terraform version: 1.5.4
- Git version: 2.46.0
- Environment details (Ubuntu 20.04, Windows 10, etc.): Mac Sonoma M1
levkohimins commented 2 months ago

Hi @Fauzyy, thanks for reporting this issue. Fixed in v0.67.9 release.

Fauzyy commented 1 month ago

Thanks @levkohimins! Confirmed fixed on my end.

levkohimins commented 1 month ago

@Fauzyy thanks for the feedback.