When using TFENV_AUTO_INSTALL in a Terragrunt repository, concurrent installations of the many different Terraform versions trigger a race condition.
This results in an error where tfenv attempts to install many versions of Terraform concurrently in parallel pipeline jobs, leading to permission denied issues.
Error Message:
/home/user/.tfenv/lib/tfenv-exec.sh: line 43: /home/user/.tfenv/versions/1.6.2/terraform: Permission denied
/home/user/.tfenv/lib/tfenv-exec.sh: line 43: exec: /home/user/.tfenv/versions/1.6.2/terraform: cannot execute: Permission denied
Reproducible Scenario:
Enable TFENV_AUTO_INSTALL in a Terragrunt repo.
Trigger pipeline with multiple jobs/plans that attempt to install many versions of Terraform not previously used.
Expected Behavior:
TFENV_AUTO_INSTALL should handle concurrent installations gracefully or sequentially, avoiding race conditions and permission denied errors.
Possible Solution:
Implement a mechanism in TFENV_AUTO_INSTALL to handle concurrent installation requests for the different Terraform versions, ensuring that only one installation process is initiated for a specific version at a time.
Issue:
When using
TFENV_AUTO_INSTALL
in a Terragrunt repository, concurrent installations of the many different Terraform versions trigger a race condition.This results in an error where tfenv attempts to install many versions of Terraform concurrently in parallel pipeline jobs, leading to permission denied issues.
Error Message:
Reproducible Scenario:
TFENV_AUTO_INSTALL
in a Terragrunt repo.Expected Behavior: TFENV_AUTO_INSTALL should handle concurrent installations gracefully or sequentially, avoiding race conditions and permission denied errors.
Possible Solution: Implement a mechanism in TFENV_AUTO_INSTALL to handle concurrent installation requests for the different Terraform versions, ensuring that only one installation process is initiated for a specific version at a time.