Use Harness Policy As Code for Feature Flags
important
Currently, this feature is behind the Feature Flags OPA_PIPELINE_GOVERNANCE
, CUSTOM_POLICY_STEP
, and OPA_FF_GOVERNANCE
. Contact Harness Support to enable the feature.
This topic describes how to create policies using the Harness Policy As Code and apply them to your Feature Flags. Harness Policy As Code uses the Open Policy Agency (OPA) to store policies on the Harness platform. For more information about how OPA and Harness Policy As Code work, see Harness Policy As Code Overview.
Before you begin
- Ensure you have read and understood Harness Policy As Code Overview.
- Ensure you have created your project and environment in the Harness platform.
- Policies use OPA authoring language Rego. New to Rego? Use the following resources to learn it:
- Free online course on Rego from Styra founder and OPA co-creator Tim Hendricks: OPA Policy Authoring.
- See Policy Language from OPA. The Rego Cheat Sheet is also helpful to have on hand.
Step: Create and Apply a Policy
To create and apply a policy, follow the steps below: