Terraform and JFrog

We are trying to connect to the JFrog Artifactory repo with the suggest method from artifactory:

#cat ~/.terraform.d/credentials.tfrc.json
{
  "credentials": {
    "ARTIFACTORY-DOMAIN": {
       "token": "IDENTITY-TOKEN"
       }
    }
}

And we always have this error:

There are some problems with the CLI configuration:
Error: The credentials "https://artifactory.itp.extra/artifactory:8443" block has an invalid hostname: port portion contains non-digit characters

We tried all kind of configuratio for host domain and always the same error

Best regard,

Steph

Hi @stephanedesjardins-qm,

A credentials block expects just a hostname and optional port number. A full URL including the https: scheme is not valid there.

I’m confused by the URL shown in your error message because it seems to include a slash inside the hostname, which would not be valid syntax even for a URL.

If artifactory.itp.extra is your Artifactory hostname and 8443 is the port number where the server is listening then the following would be the correct value to use as the hostname:

"artifactory.itp.extra:8443"

I’m not really familiar with Artifactory’s implementation of Terraform’s protocols, so I can only refer to the public documentation. From what I see there, it seems like it should work to generate the credentials file automatically using the terraform login command:

terraform login artifactory.itp.extra:8443

I think you’ve instead followed the instructions under “Manually Generating an Identity Token”, which is fine but you will still need to find the correct syntax for specifying the hostname.

If the above doesn’t help then I would suggest perhaps contacting JFrog support, because they will presumably be more familiar with Artifactory’s implementation of these protocols than I am. :grinning: