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

Terraform lock file should be copied by CopyTerraformFolderToTemp() #1116

Closed
Erouan50 opened this issue May 5, 2022 · 0 comments · Fixed by #1117
Closed

Terraform lock file should be copied by CopyTerraformFolderToTemp() #1116

Erouan50 opened this issue May 5, 2022 · 0 comments · Fixed by #1117

Comments

@Erouan50
Copy link
Contributor

Erouan50 commented May 5, 2022

Hi everyone!

I'm a heavy user of the function test_structure.CopyTerraformFolderToTemp() to run my tests in parallel. However, I noticed that the terraform.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 the terraform.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 :)

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
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant