ARTIFACTORY: Terraform modules and providers cannot be installed
Hashicorp’s recent change of CDN Providers had led to a change in the requests for modules and providers. As part of this change, attempts to install these from registry.terraform.io will result in “not found” errors. More information can be found here.
For example, this is an error returned from the terraform while running the terraform init command against the terraform-aws-modules/vpc/aws module:
$ terraform init
│ Error: Module not found
│ Module "vpc" (from main.tf:9) cannot be found in the module registry at <host>.
Due to the change, HEAD requests against the registry.terraform.io registry will return a 405 response and will fail the request. Below are examples of two HEAD requests that will return a 405 response, one when requesting a module and the other while requesting a provider:
The artifactory-request.log will log a 404 response. For example:
The suggested fix for this behavior is to bypass the HEAD requests in this repository by enabling the Bypass HEAD Requests checkbox. When checked, Artifactory will bypass the HEAD request and cache the artifact directly using a GET request. After the change, running terraform init should result in a successful resolution and the requests should return a 200 response: