Remote Terraform Repository

JFrog Artifactory Documentation

Products
JFrog Artifactory
Content Type
User Guide

Remote repositories enable you to proxy and cache your remote Terraform Modules and Providers packages.

To set up a remote repository that supports Terraform packages:

  1. Click the Administration tab at the top of the Artifactory UI and then Repositories in the naviagation bar on the left.

  2. Click the Create a Repository button.

  3. In the popup menu, select Remote. The Select Package Type window appears.

  4. Select Terraform. The New Remote Repository screen appears, as shown below.

    Note

    The remote repository settings are identical for both Providers and Modules.

    Terraform-remote-repo.png
  5. Follow the instructions in the table below for specific Terraform settings.

    Field

    Description

    URL

    The base URL of the Module storage API.

    When using Smart remote repositories, set the URL to <base_Artifactory_URL>/artifactory/repokey.

    Password/Access Token

    From Artifactory version 7.118.2 and later, if you are using a proxy GitLab or Terraform Cloud registry with this remote repository, you must put here your Bearer Token.

    • For a proxy GitLab registry, create the Bearer Token in GitLab by selecting Access Token and then Add new token in your GitLab registry.

    • For a proxy Terraform Cloud registry, create the Bearer Token by selecting API Tokens and then Generate an organization token in your Terraform Cloud registry.

    Enable Token Authentication

    You must enable this setting if you are using a proxy GitLab or Terraform Cloud registry with this remote repository.

    Git Providers

    It is recommended to select GitHub when pointing to the official HashiCorp Terraform Registry.

    Note

    Other Git Providers are not supported.

    Registry URL

    The base URL of the registry API.

    • When using Smart Remote Repositories, set the URL to <base_Artifactory_URL>/artifactory/api/terraform/repokey

    • When using OpenTofu, set the URL to https://registry.opentofu.org/

    • When using a Gitlab proxy registry, set to https://gitlab.com

    • When using a Terraform Cloud proxy registry, set to https://app.terraform.io

    Providers URL

    The base URL of the Provider's storage API.

    • When using Smart remote repositories, set the URL to <base_Artifactory_URL>/artifactory/api/terraform/repokey/providers

    • When using OpenTofu, set the URL to https://github.com/

    Note

    For information on the other settings in this screen, see Remote Repositories.

  6. If you are using a proxy Gitlab or Terraform Cloud registry with this remote repository:

    1. Click the Advanced tab at the top of the screen.

    2. Scroll down to the section External Dependency Rewrite, and select Enable External Dependency Rewrite.

      This allows you to define the trusted resources that the client can resolve from.

    3. In the Patterns Allow List, add all the URLs that you want to download from.

      • To resolve all Terraform modules in Terraform Cloud, add: https://*terraform*.io/**

      • To resolve all Terraform modules in Gitlab, add: https://gitlab.com/**

  7. When you are finished configuring the remote repository, click Create Remote Repository.

Note

Starting from version 7.39.4, The default Terraform behavior is to override the source URL when initializing a module. It is not recommended to disable this feature, but if you need to, you can do so by setting this system property:

artifactory.terraform.override.modules.source.hostname=false