We have several private modules that we want to keep private. We use terraform registry for this, but we have poly repos, over 47 of them. It would be nice to keep just one single repo for all of our modules, and then have terraform registry use these.
How do we do this?
Hi @darkn3rd,
The VCS integration mode for private module registry assumes that repositories will follow the standard module structure, and therefore works best with one repository per module package.
However, if the built-in behavior isn’t suitable for your situation then you can alternatively push locally-prepared module packages into the registry using the API, in which case Terraform Cloud will not interact with your VCS at all and so you can arrange your VCS however you like as long as you have some release automation scripts that can construct an archive for each module package that follows the standard structure.
There’s some more detail on this in the private module registry API docs:
If subdirectories in your monorepo still follow the standard module package structure within them then you should be able to directly archive the relevant subdirectory and submit the result verbatim to the upload endpoint. These steps are essentially what the automatic VCS integration would normally do except that it only knows how to do it from the root of the repository, including all of the content from the repository in the uploaded package.
We are using the automation from the tf cloud, so this means tagged poly repo.
That makes sense to use a push API, then you could use whatever scheme you want.