# dokploy_vault_provider (Data Source)

Looks up a vault provider that already exists in Dokploy (Settings > Vault Providers), for example to confirm the name that the `${{vault.<name>.<key>}}` environment variable syntax refers to:

```terraform
data "dokploy_vault_provider" "prod" {
  name = "prod"
}
```

The `provider_type` attribute says which kind of vault the record connects to. Dokploy masks the secrets of the connection config on every read, so the config blocks of the resource are not part of the data source.

~> Dokploy does not enforce name uniqueness. If two vault providers share a name, this data source fails instead of a guess. Look the record up by `id` in that case.

## Example Usage

```terraform
data "dokploy_vault_provider" "example" {
  id = "your-vault-provider-id"
}

data "dokploy_vault_provider" "prod" {
  name = "prod"
}

# The name is the first part of the vault reference in an env value.
resource "dokploy_application" "api" {
  name           = "api"
  environment_id = data.dokploy_environment.production.id
  env            = "DATABASE_URL=$${{vault.${data.dokploy_vault_provider.prod.name}.DATABASE_URL}}"

  docker = { image = "ghcr.io/example/api:latest" }
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Optional

- `id` (String) Vault provider id. Set it for a lookup by id, or leave it unset and set `name`.
- `name` (String) Display name as shown in Dokploy. Set exactly one of `id` or `name`.

### Read-Only

- `assignments` (Attributes List) Projects, and optionally specific environments in them, that can use this vault provider. (see [nested schema for assignments](#nestedatt--assignments))
- `created_at` (String) Creation timestamp from the server.
- `provider_type` (String) Kind of vault: `hashicorp` (also OpenBao), `infisical`, `aws`, `doppler`, `azure`, `scaleway`, `phase`, or `aws-parameter-store`.

<a id="nestedatt--assignments"></a>
### Nested Schema for `assignments`

Read-Only:

- `environment_ids` (Set of String) Ids of the environments that the assignment covers. Empty when it covers each environment in the project.
- `project_id` (String) Id of the assigned project.