litellm/terraform/provider/docs/data-sources/keys.md
Shivam Rawat 3653e5893f
feat(terraform): resource and data source parity with the community provider (#38158)
* feat(terraform): close key/team schema gaps, fix team read envelope, add import support

* feat(terraform): add fallback resource/data source and key/team block resources

* feat(terraform): add access group and unified access group resources and data sources

* feat(terraform): add guardrail and prompt resources and data sources

* feat(terraform): add agent and search tool resources and data sources

* feat(terraform): add user and budget resources and data sources

* feat(terraform): add tag and project resources and data sources

* docs(terraform): changelog and readme for parity additions

* feat(terraform): add data sources for keys, teams, models, organizations, and mcp servers

* fix(terraform): key update 400 on empty budget_duration, key info envelope, config-supplied key

* fix(terraform): hash raw keys to SHA-256 tokens in key lookup URLs and block resource IDs
2026-08-28 16:55:40 -07:00

62 lines
2.1 KiB
Markdown

---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "litellm_keys Data Source - terraform-provider-litellm"
subcategory: ""
description: |-
Lists LiteLLM API keys with optional server-side filters.
---
# litellm_keys (Data Source)
Lists LiteLLM API keys via `/key/list`. Supports server-side filtering and pagination. Raw key values are never returned; each entry is identified by its hashed token.
## Example Usage
```terraform
data "litellm_keys" "team_keys" {
team_id = litellm_team.ml.id
size = 50
}
output "team_key_aliases" {
value = [for k in data.litellm_keys.team_keys.keys : k.key_alias]
}
```
## Argument Reference
The following arguments are supported:
* `page` - (Optional) Page number for pagination. Defaults to `1`.
* `size` - (Optional) Number of keys per page. Defaults to `100`.
* `user_id` - (Optional) Filter keys by user ID.
* `team_id` - (Optional) Filter keys by team ID.
* `organization_id` - (Optional) Filter keys by organization ID.
* `key_alias` - (Optional) Filter keys by key alias.
* `include_team_keys` - (Optional) Include all keys for teams the caller is an admin of.
## Attributes Reference
In addition to all arguments above, the following attributes are exported:
* `total_count` - Total number of keys matching the filters.
* `total_pages` - Total number of pages.
* `current_page` - The page returned.
* `ids` - Hashed token identifiers of the returned keys.
* `keys` - List of key objects. Each entry exports:
* `token_id` - Hashed token identifier.
* `key_name` - Redacted display name.
* `key_alias` - User-friendly alias.
* `spend` - Amount spent by the key.
* `max_budget` - Maximum budget.
* `models` - Models the key can access.
* `user_id` - Associated user ID.
* `team_id` - Associated team ID.
* `organization_id` - Associated organization ID.
* `tpm_limit` - Tokens per minute limit.
* `rpm_limit` - Requests per minute limit.
* `budget_duration` - Budget reset duration.
* `blocked` - Whether the key is blocked.
* `expires` - Expiry timestamp, if set.
* `created_at` - Creation timestamp.
* `updated_at` - Last update timestamp.