Skip to content
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

Include .terraform.lock.hcl in CopyTerraformFolderToDest #1117

Merged
merged 1 commit into from
May 18, 2022

Conversation

Erouan50
Copy link
Contributor

@Erouan50 Erouan50 commented May 6, 2022

This commit adds in the filter from the function
CopyTerragruntFolderToDest an exclusion exception for the lock file.

The .terraform.lock.hcl used by Terraform to lock the versions of
the providers is not included during the copy. It can bring weird
behaviors when the copy is skipped (check the function
test_structure.CopyTerraformFolderToDest) where version 1.1 of a
provider would be used in the example folder but might be updated during
the terraform init due to the copy without the lock file. The lock
file should be included within the copy to keep the same providers'
versions.

Fix: #1116

I ran the test from the modules/files. Here is the output:

Test completed without error, however due to a limitation in GNU diff < 3.3.0, directories have not been compared for equivalency.
PASS
ok      github.com/gruntwork-io/terratest/modules/files 0.005s

I try to run the tests from the modules/terraform, but a lot of them fail
(they fail as well from master) and don't seem to be related to my changes.

This commit adds in the filter from the function
CopyTerragruntFolderToDest an exclusion exception for the lock file.

The `.terraform.lock.hcl` used by Terraform to lock the versions of
the providers is not included during the copy. It can bring weird
behaviors when the copy is skipped (check the function
test_structure.CopyTerraformFolderToDest) where version 1.1 of a
provider would be used in the example folder but might be updated during
the `terraform init` due to the copy without the lock file. The lock
file should be included within the copy to keep the same providers'
versions.

Fix: gruntwork-io#1116
Copy link
Contributor

@yorinasub17 yorinasub17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for your contribution! I'll kick off a regression test and if it passes, will merge this in.

@yorinasub17
Copy link
Contributor

Build failed, but for a known failure on master. I rebased your test branch and kicked off a new build here:

https://app.circleci.com/pipelines/github/gruntwork-io/terratest/988/workflows/1fef1dfe-f43d-4f3c-81c4-6cd68ee6d9d3

@yorinasub17
Copy link
Contributor

The updated build failed, but for a known failure from master unrelated to this change, so we can merge this in! Thanks again for the contribution!

@yorinasub17 yorinasub17 merged commit 4859f7c into gruntwork-io:master May 18, 2022
@Erouan50 Erouan50 deleted the terraform-lock-file branch May 18, 2022 18:26
@Erouan50
Copy link
Contributor Author

You're welcome, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Terraform lock file should be copied by CopyTerraformFolderToTemp()
2 participants