terraform
terraform copied to clipboard
terraform init to be explicit about when it's copying an existing module package dir vs. a direct download
Terraform Version
v1.2.4
Terraform Configuration Files
Any module that uses a remote source (eg git source) multiple times.
Debug Output
Downloading git::ssh://[email protected]/... for foo...
2022-07-12T12:49:09.522-0500 [TRACE] getmodules: fetching "git::ssh://[email protected]/..." to ".terraform/modules/foo"
Downloading git::ssh://[email protected]/... for bar...
2022-07-12T12:49:25.466-0500 [TRACE] getmodules: copying previous install of "git::ssh://[email protected]/..." from .terraform/modules/foo to .terraform/modules/bar
Expected Behavior
Per https://github.com/hashicorp/terraform/issues/29503#issuecomment-910850869 from @apparentlymart, Terraform downloads the remote source once, then copies the files for the other usages of the remote source. As a result, I would have expected the console output to say something like:
- "Copying ..."
- "Using ... from cache"
But you have to go to the trace output to see that Terraform is copying the files instead of downloading them from the remote source.
Actual Behavior
Console output says "Downloading git::ssh://[email protected]/... for bar..." for all of the modules even though download is not occurring after the source has been downloaded the first time.
Steps to Reproduce
terraform init
Additional Context
References
- https://github.com/hashicorp/terraform/issues/29503#issuecomment-910850869