terragrunt: .terragrunt-cache fails to update with new source "...?ref=..."

I’m updating my terragrunt.hcl’s terraform { source = "..." } } value with new ...?ref=<commit> values as I make adjustments, but terragrunt isn’t successfully pulling the new commit from the git repo. Instead, it complains…

[terragrunt] [/Users/jake/git/codecommit.us-west-2/jn-tf/jakesys/regions/us-west-2/vpcs/dev] 2019/06/25 18:04:19 Running command: terraform --version
[terragrunt] 2019/06/25 18:04:19 Reading Terragrunt config file at /Users/jake/git/codecommit.us-west-2/jn-tf/jakesys/regions/us-west-2/vpcs/dev/terragrunt.hcl
[terragrunt] 2019/06/25 18:04:19 Cleaning up contents of download folder /Users/jake/git/codecommit.us-west-2/jn-tf/jakesys/regions/us-west-2/vpcs/dev/.terragrunt-cache/QM1-63WWHsRnztH6ooxLgsdRMGg/tieM-yGmC7c1rfHpXzt3T9uRVsA
[terragrunt] 2019/06/25 18:04:19 Downloading Terraform configurations from git::ssh://git-codecommit.us-west-2.amazonaws.com/v1/repos/jn-tf-mod?ref=86e6f62 into /Users/jake/git/codecommit.us-west-2/jn-tf/jakesys/regions/us-west-2/vpcs/dev/.terragrunt-cache/QM1-63WWHsRnztH6ooxLgsdRMGg/tieM-yGmC7c1rfHpXzt3T9uRVsA
[terragrunt] 2019/06/25 18:04:19 Hit multiple errors:
error downloading 'ssh://git-codecommit.us-west-2.amazonaws.com/v1/repos/jn-tf-mod?ref=86e6f62': /usr/local/bin/git exited with 1: error: pathspec 'master' did not match any file(s) known to git

[terragrunt] 2019/06/25 18:04:19 Unable to determine underlying exit code, so Terragrunt will exit with error code 1

The hash subdirectories under .terraform-cache are always the same:

git::ssh://git-codecommit.us-west-2.amazonaws.com/v1/repos/jn-tf-mod//vpc?ref=6e30e8a
.terragrunt-cache
└── QM1-63WWHsRnztH6ooxLgsdRMGg
    └── tieM-yGmC7c1rfHpXzt3T9uRVsA
        └── vpc
            ├── _data.tf
            ├── _init.tf
            ├── _vars.tf
            ├── main.tf
            └── terragrunt.hcl
git::ssh://git-codecommit.us-west-2.amazonaws.com/v1/repos/jn-tf-mod//vpc?ref=c7f82af
.terragrunt-cache
└── QM1-63WWHsRnztH6ooxLgsdRMGg
    └── tieM-yGmC7c1rfHpXzt3T9uRVsA
        └── vpc
            ├── _data.tf
            ├── _init.tf
            ├── _vars.tf
            ├── main.tf
            └── terragrunt.hcl

If I delete .terragrunt-cache entirely, then it’s able to pull the new commit reference. I’ve also tested to make sure it’s actually pulling the specified commit and not just HEAD.

terraform 0.12.2 (via brew) terragrunt 0.19.4 (via brew) git 1.22.0 (via brew) macOS mojave

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 5
  • Comments: 19 (11 by maintainers)

Commits related to this issue

Most upvoted comments

Did a diff on tree -a .terragrunt-cache output “before” and “after” new commit ref updates, hopefully this will help narrow down the issue…

The “after” is missing .../.git, .../.terragrunt-source-version, and .../vpc/*.tf – otherwise the same files exist in both. The cleanup code did something (perhaps too much?); the error happens when it’s trying to re-download (git clone/pull) the module source.