> ## Documentation Index
> Fetch the complete documentation index at: https://www.qovery.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

> Configure external secrets providers within your Qovery cluster

> [!NOTE]
>
> This feature is available on:
>
> * AWS Managed Cluster
> * GCP Managed Cluster
>
> Supported Secrets Providers:
>
> * AWS Secrets Manager
> * AWS Parameter Store
> * GCP Secret Manager

> [!NOTE]
>
> The secret synchronization infrastructure is stable. The interface may evolve.

## Secret Manager Access benefits

Compared to Qovery built-in secrets, integrating a dedicated Secret Manager offers several key advantages:

* **Security and data sovereignty**: Your secrets stay entirely within your own infrastructure and are never transmitted through Qovery's systems.
  Secret values are fetched directly by External Secret Operator from your provider into your cluster, minimizing the number of systems that ever handle
  raw secret values. With built-in secrets, the value passes through Qovery's API and storage layer.

* **Centralized secret management**: Use your existing secrets provider as a single source of truth across all your infrastructure —
  Qovery services, Lambda functions, CI pipelines, and other tools all reference the same secrets without duplication.
  A secret defined once can also be consumed by multiple clusters (e.g., staging and production) without recreating it in each environment.

* **Simplified and automatic secret rotation**: When a shared secret needs updating, change it once in your secrets manager, then redeploy
  the affected services via Qovery to pick up the new value. You can also leverage native automatic rotation from your provider (e.g., database credentials
  rotated via a Lambda function) — Qovery services will benefit from it in the next deployment without any additional secret management step.

* **Audit trails and compliance**: Cloud-native secret managers provide built-in versioning, access logs, and fine-grained IAM policies —
  seamlessly extending your existing compliance posture to secrets consumed by Qovery services.

## How it works

Qovery integrates with external secrets by deploying [ESO](https://external-secrets.io/latest/) (External Secrets Operator) in your cluster.

```mermaid theme={null}
graph TB
    subgraph SecretsProvider[Your Secrets Provider]
      AWS_PS([AWS Parameter Store])
      AWS_SM([AWS Secrets Manager])
      GCP_SM([GCP Secret Manager])
    end

    AWS_PS & AWS_SM & GCP_SM ---|Read Upstream Secrets| ESO

    subgraph K8s[Your Kubernetes Cluster]
        subgraph EngineInfra[Managed at Cluster Level]
            ESO[External Secret Operator]
            CSS[Cluster Secret Store]
        end

        subgraph EngineEnv[Managed at Service Level]
            ES[External Secret]
            S[Secret]
            Pod[Pod]
        end

        ESO -->|Manages| CSS
        CSS -->|Monitors External Secrets| ES
        ES -->|Produces Kubernetes Secrets| S
        Pod -->|Uses Kubernetes Secret| S
    end

    style EngineInfra fill:transparent,stroke:orange,color:orange
    style EngineEnv fill:transparent,stroke:orange,color:orange
    style SecretsProvider fill:transparent,stroke:orange,color:orange
```

## Configure a Secret Manager Access

You can configure a Secret Manager Access in the **Add-ons** section of your cluster.

![Overview add Secret Manager Access](https://mintcdn.com/qovery/6fdDvhSOOcJ9uNJR/images/configuration/secret-manager-access/sma-cluster-edit.png?fit=max\&auto=format\&n=6fdDvhSOOcJ9uNJR\&q=85\&s=82593353feb1f5ed8780466247a6e28d)

> [!WARNING]
>
> Creating or Editing a Secret Manager Access **requires the cluster to be redeployed**

Select the guide for your secrets provider:

> [card] [AWS Secrets Manager](https://www.qovery.com/docs/configuration/integrations/secret-managers/aws-secrets-manager.md)
>
> Connect to AWS Secrets Manager from an AWS or GCP cluster

> [card] [AWS Parameter Store](https://www.qovery.com/docs/configuration/integrations/secret-managers/aws-parameter-store.md)
>
> Connect to AWS Parameter Store from an AWS or GCP cluster

> [card] [GCP Secret Manager](https://www.qovery.com/docs/configuration/integrations/secret-managers/gcp-secret-manager.md)
>
> Connect to GCP Secret Manager from a GCP or AWS cluster

## Reference the external secrets in your services

> [!WARNING]
>
> **Setting external secrets at the environment level multiplies cloud costs.**
>
> You can set external secrets at the environment level to inject them to all services, but be careful:
>
> * The secret value will be fetched individually for each service running in the environment.
> * With many services, this multiplies the number of secret fetches and can significantly increase your cloud costs.
>
> ```mermaid theme={null}
> graph TB
>     subgraph UserConfig[Your Configuration]
>         subgraph Env[Environment]
>             EnvES([External Secret at environment level])
>             subgraph Services[Services]
>                 SvcA([service-a])
>                 SvcB([service-b])
>                 SvcC([service-c])
>             end
>         end
>     end
>
>     subgraph K8s[Kubernetes Cluster]
>         ES1[ExternalSecret for service-a]
>         ES2[ExternalSecret for service-b]
>         ES3[ExternalSecret for service-c]
>         Pod1([Pod service-a])
>         Pod2([Pod service-b])
>         Pod3([Pod service-c])
>         SPACER1[ ]
>         SPACER2[ ]
>         SPACER3[ ]
>     end
>
>     EnvES --> ES1
>     EnvES --> ES2
>     EnvES --> ES3
>
>     ES1 --> Pod1
>     ES2 --> Pod2
>     ES3 --> Pod3
>
>     Pod1 ~~~ SPACER1
>     Pod2 ~~~ SPACER2
>     Pod3 ~~~ SPACER3
>
>     style UserConfig fill:transparent,stroke:orange,color:orange
>     style Env fill:transparent,stroke:#a78bfa,color:#a78bfa
>     style Services fill:transparent,stroke:#a78bfa,color:#a78bfa
>     style K8s fill:transparent,stroke:#2dd4bf,color:#2dd4bf
>     style EnvES fill:#f87171,color:#fff,stroke:#f87171
>     style ES1 fill:#f87171,color:#fff,stroke:#f87171
>     style ES2 fill:#f87171,color:#fff,stroke:#f87171
>     style ES3 fill:#f87171,color:#fff,stroke:#f87171
>     style Pod1 fill:#38bdf8,color:#fff,stroke:#38bdf8
>     style Pod2 fill:#38bdf8,color:#fff,stroke:#38bdf8
>     style Pod3 fill:#38bdf8,color:#fff,stroke:#38bdf8
>     style SPACER1 fill:transparent,stroke:transparent,color:transparent
>     style SPACER2 fill:transparent,stroke:transparent,color:transparent
>     style SPACER3 fill:transparent,stroke:transparent,color:transparent
> ```
>
> Prefer service-level secrets when only a subset of services need access to the value.

### Using the Qovery Console

Once your cluster is deployed, you can link external secrets to any service:

* Open your service
* Navigate to the **Variables** tab
* Select the **External secrets** tab
* Click **Add external secret**

![External Secrets path](https://mintcdn.com/qovery/6fdDvhSOOcJ9uNJR/images/configuration/secret-manager-access/create-external-secret-path.png?fit=max\&auto=format\&n=6fdDvhSOOcJ9uNJR\&q=85\&s=c2860a8a4f5c7905f16a9ac26bdcf285)

Qovery automatically lists the secrets available in your Secrets Provider to simplify setup:

![External Secrets list secrets available](https://mintcdn.com/qovery/6fdDvhSOOcJ9uNJR/images/configuration/secret-manager-access/create-external-secret-list.png?fit=max\&auto=format\&n=6fdDvhSOOcJ9uNJR\&q=85\&s=37e853135dbe6f4ebc7ce0caf592a45d)

You can filter results **by prefix** to narrow the list:

![External Secrets list secrets available by prefix](https://mintcdn.com/qovery/6fdDvhSOOcJ9uNJR/images/configuration/secret-manager-access/create-external-secret-list-prefix.png?fit=max\&auto=format\&n=6fdDvhSOOcJ9uNJR\&q=85\&s=60c90adda91e8e2c96e9a77191cfdff5)

To create an external secret, you need to:

* Select the Secret Manager Access
* Select the secret from your Secret Manager
* Provide the environment variable key to inject

![External Secrets details](https://mintcdn.com/qovery/6fdDvhSOOcJ9uNJR/images/configuration/secret-manager-access/create-external-secret-details.png?fit=max\&auto=format\&n=6fdDvhSOOcJ9uNJR\&q=85\&s=6bbc9bf5316ca36375aba9bfbd550e6c)

Similarly to a basic environment variable, you can create an external secret that can be mounted to a file:

![External Secret file details](https://mintcdn.com/qovery/DIhTLlyk817daTWV/images/configuration/secret-manager-access/create-external-secret-file.png?fit=max\&auto=format\&n=DIhTLlyk817daTWV\&q=85\&s=692229b24eaf0b95bdbcacd30fe651b5)

> [!WARNING]
>
> External secrets are fetched **only at deployment**. A running service won't automatically pick up changes to its external secrets — it requires a redeploy.

### Selecting a value from a JSON secret

Set `json_target_key` when creating or updating an external secret through the variable API to inject one value from a JSON document. The secret is fetched inside your cluster at deployment time.

| Surface | Field | Type |
| - | - | - |
| Variable API requests and responses | `json_target_key` | String or `null` |
| q-core variable fields | `jsonTargetKey` | `String?` |

q-core stores the selector as supplied and sends it to the deployment engine, which converts it into an ESO property expression. Send the member path shown in these examples; full GJSON queries are not supported.

> [!NOTE]
>
> JSON selection requires API and deployment engine versions that support `json_target_key`. Generated API schemas, SDKs, Console, CLI, and Terraform provider support are updated separately. The examples below use the variable API directly.

#### Create an external secret with a JSON selector

For example, the remote secret `/production/config` can contain:

```json theme={null}
{
  "database": {
    "credentials": {
      "password": "secret-db"
    }
  },
  "accounts": [
    { "password": "secret-account" }
  ],
  "database.password": "secret-dotted-key",
  "api*key": "secret-api",
  "back\\slash": "secret-backslash"
}
```

The following request body for `POST /variable` creates a variable named `DATABASE_PASSWORD` whose value at deployment will be `secret-db`:

```json theme={null}
{
  "key": "DATABASE_PASSWORD",
  "value": "/production/config",
  "is_secret": false,
  "variable_scope": "CONTAINER",
  "variable_parent_id": "00000000-0000-0000-0000-000000000002",
  "secret_manager_access_id": "00000000-0000-0000-0000-000000000001",
  "mount_path": null,
  "json_target_key": "database.credentials.password"
}
```

Replace `variable_parent_id` with your container's ID and `secret_manager_access_id` with the ID of its Secret Manager Access. The `value` field identifies the remote secret; `json_target_key` selects a value inside it. `is_secret` stays `false` for external secrets: Qovery stores the reference, while ESO fetches the secret value inside your cluster.

API responses return the original selector in `json_target_key` and keep `/production/config` in `value`. They do not return the selected password.

To create other variables from the same remote secret, change `key` and `json_target_key`:

| `json_target_key` as a JSON string | Injected value |
| - | - |
| `"database.credentials.password"` | `secret-db` |
| `"accounts.0.password"` | `secret-account` |
| `"database\\.password"` | `secret-dotted-key` |
| `"api*key"` | `secret-api` |
| `"back\\\\slash"` | `secret-backslash` |

Dots separate object members. Numeric segments select array elements, starting at `0`. A secret whose root is an array can use `0.password` to select the first element's `password`.

To select a key containing a literal dot, escape it with `\.`. JSON strings need an additional escape, so the request contains `"database\\.password"`. A literal backslash is written as `\\` in the selector and `\\\\` inside a JSON string. Backslashes before other characters remain literal for compatibility with existing key names.

Other characters, including `*`, `?`, `#`, `@`, and `|`, are literal key characters. Filters, wildcards, and transformations are not evaluated. Nested selection is explicit: `database.credentials.password` selects the nested member, while `database\.password` selects the literal key `database.password`, even when both kinds of key exist in the same document.

#### Update or clear the selection

Use `PUT /variable/{variableId}` to replace the selector. This request changes `DATABASE_PASSWORD` to select `secret-account` from the same remote secret:

```json theme={null}
{
  "key": "DATABASE_PASSWORD",
  "value": "/production/config",
  "secret_manager_access_id": "00000000-0000-0000-0000-000000000001",
  "json_target_key": "accounts.0.password"
}
```

Include the existing selector in every update that should preserve it. Omitting `json_target_key` or setting it to `null` clears the previous selection and restores whole-secret behavior. To clear it explicitly:

```json theme={null}
{
  "key": "DATABASE_PASSWORD",
  "value": "/production/config",
  "secret_manager_access_id": "00000000-0000-0000-0000-000000000001",
  "json_target_key": null
}
```

Omitting the selector or sending `null` on creation also selects the complete remote secret. An empty string is rejected.

#### Validation and compatibility

A non-null selector must:

* Contain between 1 and 256 Unicode characters.
* Have no empty path segments, such as `.password`, `database.`, or `database..password`.
* Have no control characters or leading or trailing whitespace.
* Have no trailing unescaped backslash.

`json_target_key` applies only to external secrets injected as environment variables (`EXTERNAL_SECRET`). It cannot be combined with `mount_path`, used with a file external secret (`FILE_EXTERNAL_SECRET`), or used for ordinary variables or built-in secrets.

q-core validates the selector syntax and the remote secret reference without reading the secret value. If the selected property does not exist, ESO reports the error during deployment. Changing the remote JSON still requires a redeploy before the running service receives the new value.

Environment and service clones preserve the selector. Existing variables and old deployment snapshots without this field keep whole-secret behavior. CSV imports do not set a selector.

The Terraform exporter includes `json_target_key` when a selector is set. Applying the exported configuration requires a Terraform provider version that accepts this field. Deploy the engine update before enabling JSON selection in the API.

### Using the Qovery CLI

* Create an external secret:

```bash theme={null}
qovery application external-secret create \
  --project="My Project" \
  --environment="My environment" \
  --key="MY_EXTERNAL_SECRET" \
  --reference="upstream/secret/name" \
  --secret-manager-access-name="My Secret Manager Access"
```

> [!NOTE]
>
> To create an external secret as a file, just add the `--mount-path="path"` parameter

* Update an external secret:

```bash theme={null}
qovery application external-secret update \
  --project="My Project" \
  --environment="My environment" \
  --key="MY_EXTERNAL_SECRET" \
  --reference="upstream/secret/name" \
  --secret-manager-access-name="My Secret Manager Access"
```

> [!NOTE]
>
> You can't update the mount path of an external secret (same behavior as basic environment variable)

* Delete an external secret:

```bash theme={null}
qovery application external-secret delete \
  --project="My Project" \
  --environment="My environment" \
  --key="MY_EXTERNAL_SECRET"
```

### Using external secrets with Terraform services

To pass an external secret to Terraform, first create the external secret (in the **External secrets** tab of the service, or at the environment, project, or organization level), then reference its key from a Terraform variable with the `{{ SECRET_KEY }}` syntax.

![Terraform service external secret](https://mintcdn.com/qovery/6fdDvhSOOcJ9uNJR/images/configuration/secret-manager-access/terraform-service-external-secret.png?fit=max\&auto=format\&n=6fdDvhSOOcJ9uNJR\&q=85\&s=5f100a1ebb5c28ff8b8e1c7187ae3dcd)

You can use the reference:

* In the **Terraform variables** section, as the value of a variable, for example `db_password` = `{{ DB_PASSWORD }}`
* In a `.tfvars` file from your repository, for example `db_password = "{{ DB_PASSWORD }}"`
* Inside a longer value, for example `database_url = "postgres://app:{{ DB_PASSWORD }}@db.internal:5432/app"`

Qovery never reads the secret value. The reference is resolved inside your cluster when the Terraform job starts, from the secret synced by the External Secrets Operator, and Terraform receives the value as a `-var` argument.

> [!NOTE]
>
> * External secrets mounted as a file can't be referenced from a Terraform variable.
> * References are not resolved in the **Terraform arguments** section.
> * Terraform prints variable values in its plan and apply output unless the variable is declared with `sensitive = true` in your module. Mark the variables that receive secrets as sensitive.
> * `sensitive = true` only redacts Terraform's output: resource attributes derived from the secret can still be stored in the Terraform state. Protect your state backend accordingly.

> [!NOTE]
>
> An external secret whose key follows the pattern `TF_VAR_${your_variable}` is still read by Terraform as `your_variable`, as long as no Terraform variable or `.tfvars` entry sets `your_variable`: those take precedence over `TF_VAR_*` environment variables. Prefer the `{{ SECRET_KEY }}` reference, which works with any key name and is not overridden.


## Related topics

- [Configuration Overview](https://www.qovery.com/docs/configuration/overview.md)
- [Commands Overview](https://www.qovery.com/docs/cli/commands/overview.md)
- [Security Overview](https://www.qovery.com/docs/getting-started/security-and-compliance/overview.md)
- [List environments overview](https://www.qovery.com/docs/api-reference/environments/list-environments-overview.md)
- [Qovery AI Copilot](https://www.qovery.com/docs/copilot/overview.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.