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

Managing Secrets

Create, use, rotate, and manage secrets throughout their lifecycle, including UI workflows, pipeline usage, API access, and Terraform automation.

Create, use, rotate, and manage secrets throughout their lifecycle. This guide covers the complete set of operations for working with secrets in Harness 3.0, including UI workflows, pipeline usage, API access, and Terraform automation.

Create secrets

Secrets can be created at the Account, Organization, or Project scope depending on your navigation context.

  1. Navigate to Secrets: Go to your Project, Organization, or Account settings. Select Secrets from the left navigation menu.

  2. Choose Secret Type: Click + New Secret and select either Text or File based on the type of credential you need to store.

  3. Configure Details: Provide a Name for the secret. The Identifier is auto-generated from the name but can be customized. Enter the secret Value (for text secrets) or upload the File (for file secrets).

  4. Advanced Configuration: Select the Secret Manager to use for storing the encrypted value. The Harness built-in manager is selected by default. Choose an external manager if your organization requires it.

  5. Optional Metadata: Add optional Tags to organize and filter secrets (e.g., env:prod, team:platform). Add an optional Description for documentation purposes.

  6. Save: Click Save to create the secret. The value is encrypted and stored in the selected secret manager. The secret is now available for use in pipelines and connectors within its scope.


Use secrets in pipelines

Secrets can be referenced in multiple contexts within your pipeline configuration. The secret value is resolved at runtime and automatically masked in execution logs.

In connector configuration

version: 1
kind: connector
spec:
  name: Docker Hub
  type: docker_registry
  spec:
    url: https://index.docker.io/v2/
    authentication:
      type: username_password
      spec:
        username: myuser
        password: <+secrets.getValue("dockerhub_password")>

In pipeline variables

In shell scripts

In service definitions

Use file secrets

File secrets require base64 decoding when used in shell scripts:


Rotate secrets

Regular secret rotation reduces the impact of credential compromise. Harness supports both manual rotation through the UI and automated rotation through external secret managers.

Manual rotation

  1. Generate the new credential value in the source system (e.g., create a new API token in GitHub).

  2. Navigate to the secret in Harness and click Edit.

  3. Enter the new secret value and click Save.

  4. Verify that existing pipelines and connectors work correctly with the new value by running a test execution.

  5. Revoke the old credential value in the source system once the new value is confirmed working.

Automated rotation with external managers

When using an external secret manager with automated rotation (such as AWS Secrets Manager rotation lambdas or Vault dynamic secrets), Harness automatically retrieves the latest value at pipeline execution time. No manual intervention is required in Harness.

Emergency rotation

If a secret is compromised: (1) Update the secret value in Harness or your external secret manager. (2) Revoke the compromised credential in the source system. (3) Review audit logs to identify any unauthorized access. (4) Run affected pipelines to verify the new credential works. (5) Report the incident per your organization's security policy.


View and search for secrets

List view columns

Column
Description

Name

Secret name and identifier

Type

SecretText or SecretFile

Secret Manager

The backend storing the encrypted value

Scope

Account, Organization, or Project

Tags

Assigned metadata tags

Last Modified

Timestamp of the last update

References

Count of pipelines, connectors, and services using this secret

Search and filters

Use the search bar to find secrets by name or identifier. Apply filters to narrow results by Secret Manager, Scope (Account/Org/Project), Tags, Type (SecretText/SecretFile), or Usage (in use vs. unused).

Sort the secrets list by Name, Last Modified, Type, or References count. Click a column header to toggle ascending and descending order.

Secret details view

Click on a secret to open its details view. The details page has three tabs:

  • Configuration: View and edit the secret name, identifier, description, tags, and secret manager. The value is never displayed.

  • References: See all pipelines, connectors, and services that reference this secret, with direct links to each entity.

  • Activity: View the complete audit trail including creation, modification, access events, and the user who performed each action.


Deleting secrets

Before deleting a secret, verify that it is not referenced by any active pipeline, connector, or service. Deleting a secret that is in use will cause pipeline failures.

  1. Open the secret details and navigate to the References tab. If the secret has active references, update or remove those references before proceeding.

  2. Navigate to the secret in the Secrets list.

  3. Click the three-dot menu on the secret row and select Delete.

  4. Confirm the deletion in the dialog. This action cannot be undone.

API and automation

Harness provides a REST API and Terraform provider for automating secret management.

REST API

All requests require an API key with appropriate permissions.

  • Base URL: https://app.harness.io/gateway/ng/api/v2/secrets

Terraform Provider

API KEY PERMISSIONS

API keys used for secret management must have the appropriate RBAC permissions. Ensure the API key's service account has at minimum secret_edit permissions for creating and updating secrets, and secret_delete for deletion operations.

Last updated

Was this helpful?