---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "litellm_vector_store Data Source - terraform-provider-litellm"
subcategory: ""
description: |-
  Retrieves information about an existing LiteLLM vector store.
---

# litellm_vector_store (Data Source)

Retrieves information about an existing LiteLLM vector store. This data source allows you to reference vector stores that were created outside of Terraform or in other Terraform configurations.

## Example Usage

```terraform
# Retrieve an existing vector store by ID
data "litellm_vector_store" "existing_store" {
  vector_store_id = "vs-12345"
}

# Use the vector store information in outputs
output "vector_store_info" {
  value = {
    name        = data.litellm_vector_store.existing_store.vector_store_name
    provider    = data.litellm_vector_store.existing_store.custom_llm_provider
    created_at  = data.litellm_vector_store.existing_store.created_at
  }
}
```

## Example Usage for Cross-Reference

```terraform
# Get vector store info to reference in other configurations
data "litellm_vector_store" "shared_store" {
  vector_store_id = var.shared_vector_store_id
}

# Create a model that might use the same credential as the vector store
data "litellm_credential" "store_credential" {
  credential_name = data.litellm_vector_store.shared_store.litellm_credential_name
}

resource "litellm_model" "embedding_model" {
  model_name          = "embedding-model"
  custom_llm_provider = "openai"
  base_model          = "text-embedding-ada-002"
  mode                = "embedding"
  
  additional_litellm_params = {
    credential_name = data.litellm_credential.store_credential.credential_name
  }
}
```

## Example Usage for Validation

```terraform
# Verify vector store exists and get its configuration
data "litellm_vector_store" "production_store" {
  vector_store_id = "production-vector-store-id"
}

# Create resources only if the vector store is properly configured
resource "litellm_model" "rag_model" {
  count = data.litellm_vector_store.production_store.custom_llm_provider == "pinecone" ? 1 : 0
  
  model_name          = "rag-enabled-model"
  custom_llm_provider = "openai"
  base_model          = "gpt-4"
  mode                = "chat"
  
  additional_litellm_params = {
    vector_store_id = data.litellm_vector_store.production_store.vector_store_id
  }
}
```

## Example Usage for Monitoring

```terraform
# Get vector store details for monitoring and alerting
data "litellm_vector_store" "monitored_stores" {
  for_each = toset(var.vector_store_ids)
  
  vector_store_id = each.value
}

# Output store information for monitoring systems
output "vector_store_status" {
  value = {
    for k, v in data.litellm_vector_store.monitored_stores : k => {
      name         = v.vector_store_name
      provider     = v.custom_llm_provider
      created_at   = v.created_at
      updated_at   = v.updated_at
      metadata     = v.vector_store_metadata
    }
  }
}
```

## Argument Reference

The following arguments are supported:

* `vector_store_id` - (Required) Unique identifier for the vector store to retrieve.

## Attributes Reference

In addition to all arguments above, the following attributes are exported:

* `vector_store_name` - Name of the vector store.
* `custom_llm_provider` - Custom LLM provider for the vector store.
* `vector_store_description` - Description of the vector store.
* `vector_store_metadata` - Map of metadata associated with the vector store.
* `litellm_credential_name` - Name of the LiteLLM credential used.
* `litellm_params` - Map of additional LiteLLM parameters.
* `created_at` - Timestamp when the vector store was created.
* `updated_at` - Timestamp when the vector store was last updated.

## Common Use Cases

### 1. Cross-Stack References
Reference vector stores created in other Terraform configurations:

```terraform
data "litellm_vector_store" "shared_knowledge_base" {
  vector_store_id = var.knowledge_base_id
}

# Use the same credential for consistency
resource "litellm_model" "knowledge_model" {
  model_name          = "knowledge-retrieval-model"
  custom_llm_provider = "openai"
  base_model          = "gpt-4"
  
  additional_litellm_params = {
    vector_store_credential = data.litellm_vector_store.shared_knowledge_base.litellm_credential_name
  }
}
```

### 2. Configuration Validation
Validate vector store configuration before creating dependent resources:

```terraform
data "litellm_vector_store" "target_store" {
  vector_store_id = var.target_vector_store_id
}

# Ensure the vector store uses the expected provider
locals {
  is_pinecone_store = data.litellm_vector_store.target_store.custom_llm_provider == "pinecone"
}

resource "litellm_model" "pinecone_optimized_model" {
  count = local.is_pinecone_store ? 1 : 0
  
  model_name          = "pinecone-optimized"
  custom_llm_provider = "openai"
  base_model          = "text-embedding-ada-002"
  mode                = "embedding"
}
```

### 3. Metadata-Based Logic
Use vector store metadata for conditional resource creation:

```terraform
data "litellm_vector_store" "environment_store" {
  vector_store_id = var.vector_store_id
}

# Create different resources based on environment metadata
resource "litellm_model" "production_model" {
  count = lookup(data.litellm_vector_store.environment_store.vector_store_metadata, "environment", "") == "production" ? 1 : 0
  
  model_name          = "production-rag-model"
  custom_llm_provider = "openai"
  base_model          = "gpt-4"
  mode                = "chat"
}

resource "litellm_model" "development_model" {
  count = lookup(data.litellm_vector_store.environment_store.vector_store_metadata, "environment", "") == "development" ? 1 : 0
  
  model_name          = "development-rag-model"
  custom_llm_provider = "openai"
  base_model          = "gpt-3.5-turbo"
  mode                = "chat"
}
```

### 4. Audit and Compliance
Retrieve vector store information for audit and compliance reporting:

```terraform
data "litellm_vector_store" "compliance_stores" {
  for_each = toset(var.compliance_vector_store_ids)
  
  vector_store_id = each.value
}

# Generate compliance report
output "compliance_report" {
  value = {
    for k, v in data.litellm_vector_store.compliance_stores : k => {
      store_name   = v.vector_store_name
      provider     = v.custom_llm_provider
      credential   = v.litellm_credential_name
      created_date = v.created_at
      last_updated = v.updated_at
      metadata     = v.vector_store_metadata
    }
  }
}
```

## Notes

* Vector store IDs are unique identifiers assigned by the LiteLLM system.
* The data source will fail if the specified vector store ID does not exist.
* All computed attributes reflect the current state of the vector store in the LiteLLM system.
* Use this data source to integrate with existing vector stores or to reference stores created outside of Terraform.
