Custom Private registry - "Host does not support Terraform tokens API"

Hi,

I’m trying to setup a private custom registry for terraform using Artifactory.
Artifactory Blog article : terraform repo setup

Everything seems to be working great, I’m able to upload modules, and connection test to Official Terraform registry (for providers) seems to be working fine.

Problem is, when I try to use my registry from terraform client. I get an error message:

❯ terraform login artifactory.mydomain.com
╷
│ Error: Host does not support Terraform tokens API
│ 
│ The given hostname "artifactory.mydomain.com" does not support creating Terraform authorization tokens.

Not so explicit to me. so I’m wondering what is expected from terraform cli when performing a terraform login.

Usage: terraform [global options] login [hostname]

  Retrieves an authentication token for the given hostname, if it supports
  automatic login, and saves it in a credentials file in your home directory.

  If no hostname is provided, the default hostname is app.terraform.io, to
  log in to Terraform Cloud.

  If not overridden by credentials helper settings in the CLI configuration,
  the credentials will be written to the following local file:
      /home/amundi/.terraform.d/credentials.tfrc.json

I’m curious about the “Retrieves an authentication token for the given hostname, if it supports automatic login”

Anyone that could provide some explanation on this or lead me to the correct doc ?

Thanks a lot for your help

Seems like the link you shared is for a Terraform state backend repository and not for a Terraform registry setup (not sure if that interferes with the login part though).

Woops, my bad. Wrong link. Just updated with the right one : Terraform Registry - JFrog - JFrog Documentation

Looks like a “feature” that’s not enabled on my artifactory instance but I have no clue. My ticket to the support isn’t really moving so … :confused:

Terraform modules can only be resolved from the official Terraform registry, or from a Smart Remote repository to another Artifactory repository.

Source: https://www.jfrog.com/confluence/display/JFROG/Terraform+Registry#:~:text=Resolving%20Terraform%20Module/Providers

Did you figure it out? I face the same issue :frowning:

Terraform is reporting that artifactory.mydomain.com does not support the Login Protocol.

I’m not sure if Artifactory intends to support that protocol. You could confirm whether it advertises support for the protocol by requesting https://artifactory.mydomain.com/.well-known/terraform.json, which should contain a top-level property called login.v1 if your Artifactory install has an implementation of that protocol. (That URL is for the Terraform service discovery protocol.)

The Artifactory documentation does seem to suggest that terraform login is expected to work with Artifactory, but I’m not personally familiar with Artifactory so I cannot offer any specific ideas on why this wouldn’t be working.