Introduction
Terraform resources can be structured into modules and within Terraform Enterprise, these modules may be located in the Private Module Registry. During terraform init, module blocks are identified within the configuration and the source code for referenced modules is retrieved from the locations given in their source arguments.
This article outlines a possible cause of a 403 Forbidden error when attempting to download modules.
Problem
The terraform init operation fails with the error error looking up module versions: 403 Forbidden when Terraform attempts to look up module versions.
Cause
- A proxy environment variable such as
NO_PROXYmay be configured on the Terraform Enterprise workspace.
Solution
- Locate the workspace in Terraform Enterprise, check the variables tab, and remove any proxy environment variable.
- Run
terraform initagain.