Create a new Terraform file with unifiedpolicy provider:
# Required for Terraform 1.0 and later
terraform {
required_providers {
unifiedpolicy = {
source = "jfrog/unifiedpolicy"
version = "1.0.0"
}
}
}
provider "unifiedpolicy" {
url = "https://myinstance.jfrog.io/artifactory"
// supply JFROG_ACCESS_TOKEN (Identity Token with Admin privileges) as env var
}Initialize Terraform:
$ terraform initPlan (or Apply):
$ terraform planDetailed documentation of resources and attributes will be available on Terraform Registry.
Detailed documentation is available on the Terraform Registry. Summary:
| Resource | Description |
|---|---|
| unifiedpolicy_lifecycle_policy | Manages lifecycle policies that define rules and enforcement actions for application versions at specific SDLC stages. |
| unifiedpolicy_template | Manages templates: reusable logic (business rules) for policies using Rego policy language from a .rego file. |
| unifiedpolicy_rule | Manages rules that define parameter values for policy evaluation and are based on rule templates. |
| Data Source | Description |
|---|---|
| unifiedpolicy_lifecycle_policy | Reads a single lifecycle policy by ID. |
| unifiedpolicy_lifecycle_policies | Reads multiple lifecycle policies (with optional filters). |
| unifiedpolicy_template | Reads a single template by ID. |
| unifiedpolicy_templates | Reads multiple templates (with optional filters). |
| unifiedpolicy_rule | Reads a single rule by ID. |
| unifiedpolicy_rules | Reads multiple rules (with optional filters). |
For local development, you can use dev_overrides to test the provider without publishing it to the registry.
-
Set up dev_overrides (one-time setup):
./setup-dev-overrides.sh
Or manually create/update
~/.terraformrc:provider_installation { dev_overrides { "jfrog/unifiedpolicy" = "/absolute/path/to/terraform-provider-unifiedpolicy" } direct {} }
-
Build and install the provider:
make install
-
Use Terraform commands directly (no need for
terraform init):terraform validate terraform plan terraform apply
See CONTRIBUTIONS.md for contribution guidelines and CONTRIBUTING.md for CLA and pull request process.
Before creating lifecycle policies, you must have the following resources in your JFrog Platform instance:
- Templates - Define the logic (Rego policies) for rules
- Rules - Reference templates and are enforced by policies
- Projects - Required for project-scoped policies
- Applications - Required for application-scoped policies
- Lifecycle Stages - Stages referenced in policy actions (e.g., PROD, qa, DEV)
- Lifecycle Gates - Gates for each stage (entry, exit, release)
π See the Terraform Registry documentation for setup and examples.
- Terraform 1.0+
- Artifactory 7.125.0 or later
- Xray 3.130.5 or later
- Enterprise Plus license with AppTrust entitlements
- Access Token with Admin privileges
The provider supports the following authentication methods:
- Access Token (recommended): Set via
access_tokenattribute orJFROG_ACCESS_TOKENorARTIFACTORY_ACCESS_TOKENenvironment variable - API Key (deprecated): Set via
api_keyattribute orARTIFACTORY_API_KEYorJFROG_API_KEYenvironment variable
This provider uses the JFrog Unified Policy API (/unifiedpolicy/api/v1) to manage:
- Templates β Rego-based policy logic (business rules)
- Rules β Parameterized instances of templates used in policies
- Lifecycle policies β Governance controls that apply rules at SDLC stages
Lifecycle policies are governance controls that define:
- Conditions to check (e.g., CVEs, licenses, evidence requirements)
- Actions to take when conditions are met (
blockto fail promotion,warningto allow with violation) - Scope (project-level or application-level)
- Lifecycle gates (entry, exit, release) at specific stages
See the contribution guide.
In general, this project follows semver as closely as we can for tagging releases of the package. We've adopted the following versioning policy:
- We increment the major version with any incompatible change to functionality, including changes to the exported Go API surface or behavior of the API.
- We increment the minor version with any backwards-compatible changes to functionality.
- We increment the patch version with any backwards-compatible bug fixes.
Copyright (c) 2025 JFrog.
Apache 2.0 licensed, see LICENSE file.