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
- For local file copy create a manifest with a list of files. That allows to safely delete only the files we copied on the previous copy, not worrying about stale files still living in the working dire... — committed to springload/terragrunt by ekini 5 years ago
- For local file copy create a manifest with a list of files. That allows to safely delete only the files we copied on the previous copy, not worrying about stale files still living in the working dire... — committed to springload/terragrunt by ekini 5 years ago
- docs: add comment for Terragrunt users Excluding the .git directory from the cache can cause issues with Terragrunt with a remote git source (https://github.com/gruntwork-io/terragrunt/issues/764) — committed to infracost/actions by aliscott 2 years ago
Created a PR https://github.com/gruntwork-io/terragrunt/pull/774
Did a
diffontree -a .terragrunt-cacheoutput “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.