Skip to content

Concurrent Installation Issue with TFENV_AUTO_INSTALL in Terragrunt Environments repository #422

@seifrajhi

Description

@seifrajhi

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:

/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:

  1. Enable TFENV_AUTO_INSTALL in a Terragrunt repo.
  2. 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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions