I’m wondering if Terraform Cloud supports pulling Terraform modules from the JFrog Terraform Registry. In a command-line workflow, we typically modify the file located at ~/.terraform.d/credentials.tfrc.json to include the correct registry URL and a token that grants access to the repository.
However, when using Terraform Cloud, there may be limitations in adjusting the configuration of the custom runner(in order to setup the tf cred file). So, I’m curious if there’s a common approach or agreement on how to retrieve modules from a third-party registry, or if this is even possible within Terraform Cloud.
Hi @Humilic,
In Terraform Cloud the “CLI Configuration” (the .tfrc
files you are referring to) is controlled by Terraform Cloud itself, and so you cannot customize it.
However, for credentials in particular Terraform CLI also supports providing credentials using environment variables, and Terraform Cloud allows customizing those.
For example, if your local registry has the hostname tf.example.com
then you could set an environment variable named TF_TOKEN_tf_example_com
with the value example
then that would be equivalent to a credentials configuration like the following:
credentials "tf.example.com" {
token = "example"
}
or, since you have been using the JSON form of that configuration syntax, the following:
{
"credentials": {
"tf.example.com": {
"token": "example"
}
}
}
You can configure environment variables in your workspace settings, under Variables. Take care to set this as an Environment variable, and not as a Terraform variable.
1 Like