Steps to Manually configure Terraform CLI with Artifactory

ARTIFACTORY: How to manually configure Terrafarm CLI with Artifactory, when you don’t have a Browser installed on your Unix machine to Authorize Terraform CLI with Artifactory.

AuthorFullName__c
Bandi Harish Goud
articleNumber
000005283
ft:sourceType
Salesforce
FirstPublishedDate
2022-05-22T11:20:15Z
lastModifiedDate
2023-01-22T11:06:08Z
VersionNumber
3
  1. So install Terraform CLI from Terraform CLI
  2. Create dedicated Module and Provider registries.
  3. Create a Terraform Backend Repository in Artifactory.
  4. Generate an Access Token between Artifactory and the Terraform CLI
Navigate to JFrog_Platform_UI | Admin | User Management | Generate Token |
 
User-added image
5. Create a “credentials.tfrc.json” under “~/.terraform.d/” path. The file path should be as below:

~/.terraform.d/credentials.tfrc.json

6. Update your Access Token generated in the previous step in the “credentials.tfrc.json” file and initialize via the command “terrafram init

Example format below:
#cat ~/.terraform.d/credentials.tfrc.json
{
  "credentials": {
"servername.jfrog.io": {"token": "ACCESS TOKEN" }
  }
}

Note: If you are using Access Token in “credentials.tfrc.json” you don’t have to login again (terraform login servername.jfrog.io [not required] )