Skip to main content

Add Targets

Targets are used to control which users see which Variation of a Feature Flag, for example, if you want to do internal testing or a beta program before a broader roll out, you can enable the Flag for some users and not others. While we refer to targeting users, when you create a Target you give it a name and a unique identifier, so a Target can be anything that can be uniquely identified. For example, a Target can be a user, an application, a system, a machine, or any resource uniquely identified by an IP address, email ID, user ID, etc.

This topic describes how to add Targets to an Environment. After you’ve added the Target, you can add it to a Target Group or to a Feature Flag

note

You can add a Target using Harness UI. Alternatively, you can add a Target and define its attributes in your application's code directly using a Feature Flag SDK. The Targets added in your code are discovered automatically and populated in the Harness UI.

Regex requirements for Target names and identifiers

A Target is identified by a name and an identifier. The name and identifier you enter must conform to the following regex:

Name

Regex: [\\p{L}\\d [email protected]_-]

Must consist of only alphabetical characters, numbers, and the following symbols: 

  • . (period)
  • @ (at sign)
    • (dash)
  • _ (underscore)

The characters can be lowercase or uppercase and can include accented letters, for example Café_123.

Identifier

Regex: [[email protected]_-]

Must consist of only alphabetical characters, numbers, and the following symbols: 

  • . (period)
  • @ (at sign)
    • (dash)
  • _ (underscore)

The characters can be lowercase or uppercase but cannot include accented letters, for example CF.789.

Add a Target

A Target is identified by a name and an identifier. Make sure your Target names and identifiers conform to the regex explained in Review Regex Requirements for Target Names and Identifiers. To add a Target:

  1. In Feature Flags, in Target Management, select Targets.
  2. Click + Target.
  3. In Add Target(s), select Add a Target.
  4. In Name, enter the name that will appear in the Target Management page so you can identify this Target.
  5. In Identifier, enter a unique identifier for your Target. When Targeting Users with Flags or Managing Target Groups, the Targets are identified by the identifier you give them.
  6. You can add multiple Targets. Click + to add more Targets.
Adding Targets

Figure 1: Adding Targets

  1. When you’ve added all the Targets, Click Add.

Upload a List of Targets

This option allows you to import a list of Targets in CSV format. To do this:

  1. In Feature Flags, in Target Management, select Targets.
  2. Click + Target.
  3. In Add Target(s), select Upload a list of Targets.
  4. Upload your CSV file as per the template below. The CSV file must have only the Name and Identifier; do not include any headings, for example:
Target_4T4
Target_5T5
Target_6T6
  1. Click Add.
A screenshot of the Add Target screen that highlights the radio button for uploading a list of Targets.

Figure 2: Adding Targets from a CSV file

  1. The list of Targets is added.

A screenshot of the Target Management page with a list of all the Targets. Figure 3: The list of Targets added to the Harness Platform

Next steps

After your have created a Target, you can: