-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Terraform lock file should be copied by CopyTerraformFolderToTemp() #1116
Comments
Erouan50
added a commit
to Erouan50/terratest
that referenced
this issue
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: gruntwork-io#1116
yorinasub17
pushed a commit
that referenced
this issue
May 18, 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
yorinasub17
pushed a commit
that referenced
this issue
May 18, 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi everyone!
I'm a heavy user of the function
test_structure.CopyTerraformFolderToTemp()
to run my tests in parallel. However, I noticed that theterraform.lock.hcl
is not copied and can lead to some surprises. Terraform gets the latest version of the provider during the' terraform init', but the version might not match the one locked in theterraform.lock.hcl
of the test infrastructure. However, if I skip a step (with "SKIP_teardown" for example), the copy is skipped, and the terraform init would use the lock file to get the version. That can lead to a weird situation where I have a test that would fail in normal mode but succeed in skip mode.So I think the function should copy the .terraform.lock.hcl to have consistent behavior, but I might be wrong. What do you think?
I'm ready to open a pull request :)
The text was updated successfully, but these errors were encountered: