Environment Variable Configuration (Recommended for CI/CD)

JFrog Artifactory Documentation

Products
JFrog Artifactory
Content Type
User Guide

For CI/CD pipelines and automated deployments, using environment variables is often more secure and convenient than storing credentials in configuration files. Terraform automatically detects and uses host-specific environment variables.

Setting Up Environment Variables

  1. Set the JFrog URL.

    export JFROG_URL=https://[JFrogPlatformURL]
  2. Set the Access Token.

    export JFROG_ACCESS_TOKEN=your-access-token-here

Environment Variable Naming Convention

Terraform uses the following naming pattern for environment variables:

  • TF_VAR_<variable_name> for Terraform variables

  • Host-specific variables like JFROG_URL and JFROG_ACCESS_TOKEN for provider configuration

CI/CD Pipeline Example

For GitHub Actions, GitLab CI, or other CI/CD systems:

# GitHub Actions example
- name: Configure JFrog credentials
  run: |
    echo "JFROG_URL=https://[JFrogPlatformURL]" >> $GITHUB_ENV
    echo "JFROG_ACCESS_TOKEN=${{ secrets.JFROG_ACCESS_TOKEN }}" >> $GITHUB_ENV

Benefits of Environment Variable Approach

  • Security: Credentials are not stored in version control

  • Simplicity: No need to create or manage configuration files

  • Flexibility: Easy to switch between different environments

  • CI/CD Friendly: Seamless integration with automated deployment pipelines

Fallback to Configuration File

If environment variables are not set, Terraform will fall back to:

  • CLI configuration file (~/.terraformrc or %APPDATA%\terraform.rc)

  • Terraform configuration files (.tf files)

To learn more, see Terraform CLI configuration.