-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Allow multiple processes to run terraform providers mirror
concurrently with the same target directory
#32137
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
Comments
terrafom provider mirror
- could stagingPath
be made an optional flag? terrafom providers mirror
- could stagingPath
be made an optional flag?
terrafom providers mirror
- could stagingPath
be made an optional flag? terraform providers mirror
- could stagingPath
be made an optional flag?
Hi @bgfraser! Thanks for this feature request. After reviewing this code, I believe that it's a requirement that However, I think it could be reasonable to change the process for generating that path so that it includes a component that is likely to be unique for each concurrent process. Currently it just prepends a dot, and so all processes generate the same temporary path. It could instead prepend a string which includes a pseudorandom number, or the current process ID, or something along those lines so that the staging directory still belongs to the correct parent directory but has a different name in each process. I think supporting concurrent work here has an additional requirement too: in the final step where the command calls There is a similar discussion over in #31964 about introducing some similar logic for the global cache directory, so that multiple concurrent writers can cooperate to populate the cache. Over there I shared some concerns about making this implementation safe across all of the platforms Terraform supports, and I think that same concern also applies here but it's helpful to see that (My sense is that it's lower risk to try this in |
terraform providers mirror
- could stagingPath
be made an optional flag? terraform providers mirror
concurrently with the same target directory
Thank you @apparentlymart for the considered and positive response, and apologies for my slow response! I very rarely use GH public so I only just saw it. I'll have a poke around over the EOY break and see if I can come up with a workable modification. |
Terraform Version
Use Cases
Using
ls -d modules/*/ | xargs -P ...
to run parallelterraform providers mirror
processes against a large local module directory has some failures due to the concurrent processing of the archive files in thestagingPath
location.Attempted Solutions
No solution available within existing features. Any parallel implementation of
terraform providers mirror
on the same filesystem risks failures if two threads are processing the same provider concurrently. Examples of this error in cli output:Proposal
If
stagingPath
,terraform/internal/command/providers_mirror.go
Line 189 in 4fb8a5a
xargs
with a unique prefix or suchlike, allowing for a unique staging location per process.References
No response
The text was updated successfully, but these errors were encountered: