ARTIFACTORY: How to Configure a Remote Terraform Repository for the Coder Registry

ARTIFACTORY: How to Configure a Remote Terraform Repository for the Coder Registry

Products
Frog_Artifactory
Content Type
User_Guide
AuthorFullName__c
Omri Otmazgin
articleNumber
000006890
FirstPublishedDate
2026-03-25T09:28:55Z
lastModifiedDate
2026-03-25
Introduction

The Coder Registry hosts Terraform modules used to build and extend Coder workspaces. Organizations that use JFrog Artifactory as their central binary repository manager often need to proxy the Coder Registry through Artifactory to gain caching, access control, and auditability.

The most common configuration mismatch when creating a remote Terraform repository for the Coder Registry is configuring the correct URL, but leaving the Registry URL and Providers URL fields at their default values (https://registry.terraform.io and https://releases.hashicorp.com). Both fields must be changed to https://registry.coder.com/. Without this change, Artifactory looks up modules against the wrong registry and terraform init fails.

This article walks you through configuring a remote Terraform repository that proxies the Coder Registry, setting up an optional virtual repository, and configuring your Terraform client to download Coder modules through Artifactory.

Resolution

Step 1: Create a Remote Terraform Repository
  1. In the Artifactory UI, navigate to Administration > Repositories > Remote and click New Remote Repository.
  2. Select Terraform as the package type.
  3. Set the following fields:
Step 2: Configure the Terraform Settings

This is the most commonly missed step. Scroll to the Terraform Settings section on the right side of the repository configuration page and set both fields:
Without these values, Artifactory attempts to resolve modules against the default HashiCorp registry instead of the Coder Registry. Note that the Providers URL here refers to Coder's own providers (such as coder/coder), not standard HashiCorp providers like hashicorp/null or hashicorp/random.
  1. Click Create Remote Repository.
User-added image 

Step 3 (Optional): Set Up a Virtual Terraform Repository

A virtual repository provides a single access point that aggregates multiple local and remote Terraform repositories. This is useful when you proxy both the Coder Registry and the public Terraform Registry through separate remote repositories.
  1. Navigate to Administration > Repositories > Virtual and click New Virtual Repository.
  2. Select Terraform as the package type.
  3. Set the following fields:
    • Repository Key: e.g., tf-virtual
  4. Under Repositories, move your remote repositories (e.g., tf-coder-remote, tf-hashicorp-remote) and any local repositories into the Selected Repositories list.
  1. Click Save & Finish.
Step 4: Configure the Terraform Client

The easiest way to generate the correct client configuration is to use Artifactory's Set Me Up feature:
  1. In the Artifactory UI, navigate to Application > Artifactory > Artifacts.
  2. Select your Terraform repository (e.g., tf-virtual) and click Set Me Up.
  3. Enter your password or token when prompted, and click Generate Token & Create Instructions.
  4. Copy the generated .terraformrc snippet into your ~/.terraformrc file (on Linux/macOS) or terraform.rc file (on Windows).
For more details, see Use Artifactory Set Me Up for Configuring Package Manager Clients.

The generated configuration contains a credentials block with your Artifactory hostname and a reference token:
credentials "mycompany.jfrog.io" {
  token = "<reference-token>"
}
Note:
If you also need to proxy providers through Artifactory, create a separate remote Terraform repository with the default Terraform Settings values (Registry URL: https://registry.terraform.io, Providers URL: https://releases.hashicorp.com), add it to a virtual repository, and configure a network_mirror block in your .terraformrc. See Configure a Smart Remote Repository for Terraform for details.
Then configure your Terraform files to source modules through Artifactory:
 
terraform {
  required_providers {
    coder = {
      source = "coder/coder"
    }
  }
}

module "dotfiles" {
  source   = "<artifactory_url>/tf-virtual__coder/dotfiles/coder"
  version = "1.2.3"
  agent_id = "test-agent-id"
}
The module source follows the pattern <artifactory_url>/<virtual-repo>__<namespace>/<module>/<provider>. In this example, tf-virtual__coder refers to the virtual repository tf-virtual proxying the coder namespace from the Coder Registry.

Step 5: Verify the Configuration
1.Clear any existing local Terraform cache
rm -rf .terraform
rm -f .terraform.lock.hcl
 

2. Initialize Terraform:

terraform init
Terraform should download Coder modules through Artifactory. You can confirm this by checking the Artifactory request log for your remote repository or by browsing the cached artifacts in the Artifactory UI under the remote repository's cache.

Conclusion
To proxy the Coder Registry through Artifactory, create a remote Terraform repository with the URL set to https://registry.coder.com/ and -- critically -- set both the Registry URL and Providers URL fields to https://registry.coder.com/ in the Terraform Settings section. Without these values, Artifactory attempts to resolve modules against the default HashiCorp registry and fails. The .terraformrc credentials block authenticates the Terraform client to Artifactory; no network_mirror configuration is needed unless you also proxy standard providers through a separate repository.

For more information, see: