-
-
Notifications
You must be signed in to change notification settings - Fork 981
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Copy lock file only when needed #2823
base: main
Are you sure you want to change the base?
Conversation
|
@denis256 I had some trailing whitespaces. Fixed in the latest commit by running terragrunt/.circleci/config.yml Line 105 in e5081e1
|
util/file.go
Outdated
return errors.WithStackTrace(destReadErr) | ||
} | ||
|
||
if string(sourceContents) == string(destinationContents) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
util/file.go:613:5: stringXbytes: suggestion: bytes.Equal(sourceContents, destinationContents) (gocritic)
if string(sourceContents) == string(destinationContents) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved in b3b9287
Failed integration tests:
|
Will be also helpful to add an integration test which will track that the lock copy works as expected. |
9fa1844
to
889aca5
Compare
I added some unit tests. Integration tests seem a lot more involved and I'm not super familiar with Go. Are unit tests sufficient? |
Description
Terragrunt copies lock files into the working directory every time Terraform is initialized. This is inconsistent with the Terraform behaviour where the lock file is only written to when changed.
This is important when the working directory is on a readonly filesystem. I work with an organization that does this to prevent unintentional code changes during provisioning.
This PR makes it so that copying the lock file is avoided when the file has no changes.
TODOs
Read the Gruntwork contribution guidelines.
Release Notes (draft)
Added / Removed / Updated [X].
Updated the lock file copy mechanism to avoid copying when the lock file is unchanged. Useful for using a readonly working directory.