mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-07 08:26:10 +00:00
* feat(terraform): vendor terraform-provider-litellm as source of truth with endpoint drift CI * fix(terraform): address review feedback on vendored provider Replace deprecated io/ioutil with io. Remove the unused org/team CRUD client methods so the endpoint audit only tracks live call sites (54 -> 46). Redact request/response logs by parsing the JSON and recursively masking sensitive fields, which fixes the nested-object leak in the old credential_values regex, with a regex fallback for non-JSON payloads; covered by new unit tests. Docs: stop showing api_key inside vector store litellm_params and document that Sensitive attributes still persist in plaintext state, recommending litellm_credential_name and an encrypted state backend. * fix(terraform): stop persisting server-returned litellm_params into vector store state The vector store Read wrote litellm_params straight back from the API response into state. The proxy redacts secrets in those responses, so the readback overwrote user config with redaction sentinels and caused perpetual diffs, and against a server that returns raw values it would persist secrets into a non-Sensitive attribute. Read now preserves the config value like the credential and model resources do, litellm_params is marked Sensitive, and a regression test pins that a server-returned api_key never lands in state * fix(terraform): send role on team member update and stop persisting server env into MCP state The team member update payload omitted role, and the proxy leaves role unchanged when the field is absent, so a role downgrade reported as applied by Terraform never took effect on the proxy. The update now always sends the configured role (the attribute is Required). The MCP server resource wrote env straight back from API responses into a non-Sensitive attribute, pulling admin-visible secrets into state and, for sanitized responses, blanking user config. Read now preserves the config value, env is marked Sensitive, and the docs warn against passing secrets via args. Regression tests cover both fixes and fail against the previous behavior.
4.1 KiB
4.1 KiB
| page_title | subcategory | description |
|---|---|---|
| litellm_credential Resource - terraform-provider-litellm | Manages a LiteLLM credential for storing sensitive authentication information. |
litellm_credential (Resource)
Manages a LiteLLM credential for storing sensitive authentication information. Credentials can be used to securely store API keys, tokens, and other sensitive data that can be referenced by models and vector stores.
Example Usage
Basic OpenAI Credential
resource "litellm_credential" "openai_cred" {
credential_name = "openai-api-key"
model_id = "gpt-4"
credential_info = {
provider = "openai"
region = "us-east-1"
purpose = "chat-completions"
}
credential_values = {
api_key = var.openai_api_key
org_id = var.openai_org_id
}
}
Anthropic Credential
resource "litellm_credential" "anthropic_cred" {
credential_name = "anthropic-api-key"
credential_info = {
provider = "anthropic"
purpose = "text-generation"
}
credential_values = {
api_key = var.anthropic_api_key
}
}
Pinecone Vector Store Credential
resource "litellm_credential" "pinecone_cred" {
credential_name = "pinecone-production"
credential_info = {
provider = "pinecone"
environment = "production"
region = "us-east-1"
}
credential_values = {
api_key = var.pinecone_api_key
index_name = "document-embeddings"
}
}
Using Credentials with Vector Store
resource "litellm_vector_store" "example" {
vector_store_name = "my-vector-store"
custom_llm_provider = "pinecone"
litellm_credential_name = litellm_credential.pinecone_cred.credential_name
vector_store_description = "Example vector store using Pinecone"
vector_store_metadata = {
environment = "production"
team = "ai-team"
}
}
Multiple Provider Credentials
# AWS Bedrock credential
resource "litellm_credential" "aws_bedrock" {
credential_name = "aws-bedrock-cred"
credential_info = {
provider = "aws"
service = "bedrock"
region = "us-east-1"
}
credential_values = {
aws_access_key_id = var.aws_access_key_id
aws_secret_access_key = var.aws_secret_access_key
aws_region = "us-east-1"
}
}
# Azure OpenAI credential
resource "litellm_credential" "azure_openai" {
credential_name = "azure-openai-cred"
credential_info = {
provider = "azure"
service = "openai"
}
credential_values = {
api_key = var.azure_openai_key
api_base = var.azure_openai_endpoint
api_version = "2023-12-01-preview"
}
}
Argument Reference
The following arguments are supported:
credential_name- (Required) Name of the credential. This will be used as the identifier for the credential.credential_values- (Required, Sensitive) Map of sensitive credential values such as API keys, tokens, etc.model_id- (Optional) Model ID associated with this credential.credential_info- (Optional) Map of additional non-sensitive information about the credential.
Attributes Reference
In addition to all arguments above, the following attributes are exported:
credential_name- The name of the credential.
Import
Credentials can be imported using their name:
terraform import litellm_credential.example "credential-name"
Security Considerations
- The
credential_valuesfield is marked as sensitive and will not be displayed in Terraform output or logs. - Credential values are not read back from the API for security reasons, so they are preserved in the Terraform state.
- Like every Terraform attribute marked
Sensitive,credential_valuesis still written in plaintext to the state file. Anyone with read access to the state (or state artifacts such as plan files) can recover the configured secrets. Use an encrypted remote backend with tight access controls, and prefer feeding secrets in via variables sourced from a secret manager rather than hardcoding them in configuration.