Get Started with Unified Policy Provider

The JFrog Unified Policy Terraform Provider enables you to define and manage lifecycle policies as code through the Unified Policy API. You can programmatically create governance rules that check for specific conditions (like CVEs, licenses, or required evidence), configure enforcement actions (block promotions or issue warnings), and apply these policies at different lifecycle gates (entry, exit, release) across specific stages.

The procedure below will help you get started with the Terraform provider for Unified Policy.

In addition, detailed information, including prerequisites, software requirements, setup, authentication details, resource and data sources, and examples are specified in the Terraform documentation, Terraform Provider for Unified Policy.

To initialize the Unified Policy Provider:

  1. Copy and paste the code below into your Terraform configuration.
terraform {
  required_providers {
    unifiedpolicy = {
      source  = "jfrog/unifiedpolicy"
      version = "1.0.0"
    }
  }
}

# you can use also the environment variables instead
# export JFROG_URL="https://myinstance.jfrog.io/artifactory"
# export JFROG_ACCESS_TOKEN="my-access-token"

provider "unifiedpolicy" {
  url          = "https://myinstance.jfrog.io/artifactory"
  access_token = "my-access-token"
}

resource "unifiedpolicy_rule" "example" {
  name        = "Example Rule"
  description = "Example rule for policies"
  template_id = "REPLACE_WITH_TEMPLATE_ID"
  parameters  = []
}
  1. Run: terraform init

From this point, you can create lifecycle policies, rules, and templates, as described in the Terraform Provider documentation.