Is there a way to do the following?
- Pre-download any module dependencies declared and store them in a local filesystem (or alternate local registry or remote)
- Proxy those modules when running
plan
orapply
I know about provider mirrors, as well as the older terraform-bundle
, but had understood that is solely for provider plugins, not for modules, and doesn’t quite do the above.
Here is my use case.
I write a config that depends on some module. That module is hosted on the hashicorp registry, or git remote (like gruntwork).
When I actually run my CD pipeline, I am restricted from network access, and may not have credentials to some of those.
What I want to be able to do is analyze my config (I actually have many configs, referencing many modules) in advance, pre-download all of the modules, and then have CD read those source = <some remote>
as “get <some remote>
from a local filesystem (or registry)”.
Complicating it further, is that it is possible that one of the referenced modules in turn references other modules, etc.
I was thinking I could do a tf init
, which should download everything. If I somehow then made it available to CD, it might use the init dir. But I obviously do not want to check in my TF_DATA_DIR
.
I must not be the first person with this issue. Others, e.g. with restricted access and enterprise artifact repositories, must do something like this?