Fetch templates from Git repositories with authentication
Published On
Dec 17, 2024 - 12:59 PM
Fetch templates from Git repositories with authentication
Describes how to set up Enterprise Marketplace so it can fetch templates from Git repositories that require authentication.
In addition to being stored in the Terraform Registry, Terraform modules can also be stored in a Git repository. Before these modules can be retrieved by Enterprise Marketplace, you need to link to the Git repository.
This feature is only available for V3 authorization tenants.
Before you can link to the GitHub repository, you need to generate a personal access token for the user that you are using to link to the repository. If you do not have access to this or have not generated it yet, then complete these steps. If you already have the token, skip to the next step.
Log in to the GitHub repository using the user that you want to use to connect with, click the
User
icon and select
Settings
.
On the
Public profile
page, click
Developer settings
at the bottom of the navigation pane.
On the
GitHub Apps
page, click
Personal access tokens
→
Tokens (classic)
.
Click
Generate new token
→
Generate new token (classic)
.
On the
New personal access token (classic)
page, create a token with a descriptive name in the
Note
field and select
repo
as the
scope
.
Click
Generate token
. Be sure to record the personal access token, as this will be the only time that it is displayed.
Create the connection using the following steps:
In the Git repository, navigate to the folder where you want to retrieve the modules from and click the
If the root Terraform template contains references to the modules, in order for the modules to be discovered and represented as configuration groups in the configuration management of a catalog discovered as part of the import from file action, the following steps need to be taken:
The variables of the modules need to be declared in the root terraform template along with the values.
Make sure to declare these variables in the modules as well and the variable references should be properly declared in the module Terraform template.
The configuration group name will be equivalent to the module name as mentioned in the root Terraform template.