In this chapter dedicated to Terraform modules, we have seen that it is possible to put the code of a module in a GitHub repository to publish it in the Terraform public registry.
However, in enterprises, there is a need to create modules without exposing the code of these modules publicly by archiving them in GitHub repositories, which are public, that is, accessible by everyone.
What you need to know is that there are several types of Terraform module sources, as indicated in this documentation: https://www.terraform.io/docs/modules/sources.html.
In this recipe, we will study how to expose a Terraform module through a private Git repository. That is to say, either this Git is installed internally (so-called on-premises) or in cloud mode, SaaS, but requires authentication.
Getting ready
For this recipe, we will use a Git repository in Azure Repos (Azure DevOps), which is free and requires authentication to access it. For more...