The Typesense Terraform provider manages resources on Typesense Cloud using the Cloud Management API. It supports full lifecycle management of clusters, in-place configuration changes, server parameters, cluster cloning, and API key generation.
This is a fork of pRxEngage/terraform-provider-typesense, maintained by Spare Labs under the same MPL-2.0 license.
- Cluster lifecycle — create, update, and terminate Typesense Cloud clusters
- In-place configuration changes — scale memory, vCPU, GPU, HA, HPD, and server version without replacing the cluster (automatic polling until complete)
- Rolling restarts — server configuration parameter changes trigger automatic rolling restarts
- Cluster cloning — clone clusters to other regions
- Ephemeral API keys — generate admin and search-only API keys as ephemeral resources (never persisted to state) or as managed resources
- Memory/vCPU validation — built-in compatibility matrix prevents invalid tier combinations at plan time
terraform {
required_providers {
typesense = {
source = "sparelabs/typesense"
}
}
}
provider "typesense" {
# Set via TYPESENSE_CLOUD_MANAGEMENT_API_KEY env var, or:
# api_key = "your-management-api-key"
}
resource "typesense_cluster" "example" {
memory = "0.5_gb"
vcpu = "2_vcpus_1_hr_burst_per_day"
regions = ["oregon"]
name = "my-cluster"
}The provider requires a Typesense Cloud Management API key. You can provide it in two ways:
- Environment variable (recommended):
export TYPESENSE_CLOUD_MANAGEMENT_API_KEY="your-key" - Provider configuration: set the
api_keyattribute in the provider block
| Resource | Description |
|---|---|
typesense_cluster |
Manages a Typesense Cloud cluster |
typesense_cluster_configuration_change |
Schedules infrastructure scaling and version upgrades |
typesense_cluster_server_configuration_parameter |
Manages runtime server configuration parameters |
typesense_cluster_cloning_operation |
Clones a cluster to another region |
typesense_cluster_api_keys |
Generates cluster API keys (admin + search-only) |
| Data Source | Description |
|---|---|
typesense_cluster |
Reads a single cluster by ID |
typesense_clusters |
Lists all clusters in the account |
git clone https://github.com/sparelabs/terraform-provider-typesense.git
cd terraform-provider-typesense
make install# Unit tests
make test
# Acceptance tests (requires TYPESENSE_CLOUD_MANAGEMENT_API_KEY)
make testaccmake generatemake fmt
make lintSee CONTRIBUTING.md for more details on contributing to this provider.
