Search code examples
terraformterraspace

Terraspace Bundle: ERROR: There was a git error - fatal: not a git repository (or any of the parent directories): .git


When I run terraspace bundle I see the following error message:

Bundling with Terrafile...
ERROR: There was a git error
Current dir: /private/tmp/terraspace/bundler/cache/github.com/cloudposse/terraform-aws-cloudfront-s3-cdn
The error occur when running:
git pull 2>&1
fatal: not a git repository (or any of the parent directories): .git

Only certain modules in my Terrafile seem to have this issue as I am able to bypass the problem by commenting those failing modules out.


Solution

  • I decided to try rm -rf /private/tmp/terraspace/bundler/cache/<module> on each of the failing modules.

    After I did so the modules installed correctly:

    Bundling with Terrafile...
    Exporting aws-iam-role
    Exporting ecr
    Exporting iam-system-user
    Exporting s3-cdn
    Modules saved to vendor/modules
    

    I am uncertain of the root cause of the corrupted cache.