For the complete documentation index, see llms.txt. This page is also available as Markdown.

Policy As Code for FME Feature Flags

Learn how to create, update, and view policies and policy sets for FME feature flags and feature flag definitions.

Harness provides governance using Open Policy Agent (OPA), Policy Management, and Rego policies.

You can create a policy and apply it to FME (Feature Management & Experimentation) feature flags and feature flag definitions in your Account, Org, or Project. Harness supports two FME entity types:

  • FME Feature Flag: the feature flag itself (name, description, status, owners, tags).

  • FME Feature Flag Definition: the per-environment definition of a feature flag (treatments, targeting rules, flag sets).

Both entity types are evaluated on the On Save trigger, which fires whenever a feature flag or definition is created, updated, deleted, or archived.

Go to Using Harness Policy As Code with FME for complete documentation on FME policy setup, including the input payload reference.

Prerequisites

Complete these steps before you create a policy for FME entities.

FME feature flag policies

Step 1: Add a policy

Create the Rego policy that Harness evaluates against your FME feature flags.

  1. In Harness, go to Account Settings → Policies → New Policy.

  2. Enter a Name for your policy and click Apply.

  3. Add your Rego policy in the editor.

    You can write your own Rego policy or use a sample from the Library panel. Select the Library tab, choose Entity: FeatureFlag from the dropdown:

    FME Feature Flag sample policies in the Library panel

    Harness ships three sample policies for FME feature flags:

    • FME Feature Flag – Naming Convention: Ensures that FME feature flag names follow organizational naming conventions.

    • FME Feature Flag – Required Tags: Ensures that FME feature flags have required tags for categorization and tracking.

    • FME Feature Flag – Team Ownership Required: Ensures that FME feature flags have at least one owner and all owners are teams, not individual users.

    Below are the Rego policies for all three samples.

Enforce naming conventions

This policy ensures feature flag names start with ff_, contain only lowercase letters, numbers, and underscores, and are between 5 and 100 characters.

Require tags for categorization

This policy ensures every feature flag has at least one tag and includes required tags for owner, team, service, and component.

Enforce team ownership

This policy ensures every feature flag has at least one owner and that all owners are teams rather than individual users.

  1. Click Save.

Step 2: Add the policy to a policy set

Add the policy to a policy set scoped to the FME Feature Flag entity type.

  1. Go to Policies → Policy Sets → New Policy Set.

  2. Enter a Name and optional Description for the Policy Set.

  3. In Entity type, select FME Feature Flag.

  4. In On what event should the Policy Set be evaluated, select On Save.

  5. Click Continue.

    Existing feature flags are not automatically evaluated against new policies. Policies are applied only when a feature flag is saved (created, updated, deleted, or archived).

  6. In Policy evaluation criteria, click Add Policy.

  7. In the Select Policy dialog, choose the scope (Project, Org, or Account) and select the policy you created.

    Select a policy for the policy set
  8. Select the severity and action for policy violations:

    • Warn & continue: a warning is displayed if the policy is not met, but the feature flag is saved and you can proceed.

    • Error and exit: an error is displayed and the feature flag is not saved if the policy is not met.

  9. Click Apply, then click Finish.

  10. The Policy Set is automatically set to Enforced. To disable enforcement, toggle off the Enforced button.

FME feature flag definition policies

FME Feature Flag Definition policies govern the per-environment configuration of feature flags: treatments, targeting rules, and flag sets.

When creating a Policy Set for definitions, select FME Feature Flag Definition as the entity type. The evaluation trigger is On Save.

Go to FME Feature Flag Definition policies for policy samples that require the default treatment to be off or require flag sets for production.

See also

Related governance topics cover FME policy setup and the broader policy set workflow.

Next steps

Continue your governance setup with these related resources.

Last updated

Was this helpful?