Configuration_
Configure the Appwrite Terraform provider for Cloud or Community Edition using endpoints, API keys, and optional environment variables.
3 min read
The Appwrite provider is published as appwrite/appwrite on the Terraform Registry. The registry hosts generated reference docs for the provider and every resource and data source: latest docs. Full examples and attribute tables also live in the provider repository.
Terraform block
Declare the provider source in a terraform block. You can add a version constraint when you want to pin a release; see published versions on the registry provider page.
terraform { required_providers { appwrite = { source = "appwrite/appwrite" } }}Appwrite Cloud
Replace <REGION> with your project’s region subdomain (see Regions).
provider "appwrite" { endpoint = "https://<REGION>.cloud.appwrite.io/v1" project_id = "project-id" api_key = "api-key"}Community Edition
For self-hosted Appwrite instances, set your instance URL and enable self_signed when you use a certificate that is not trusted by default (common in local or internal deployments):
provider "appwrite" { endpoint = "https://appwrite-instance.com/v1" project_id = "project-id" api_key = "api-key" self_signed = true}Environment variables
You can supply credentials via environment variables instead of hard-coding them in .tf files (recommended for CI and local development):
export APPWRITE_ENDPOINT="https://<REGION>.cloud.appwrite.io/v1"export APPWRITE_PROJECT_ID="project-id"export APPWRITE_API_KEY="api-key"When an environment variable is set, the matching provider argument does not need to appear in the configuration. Values set directly in the provider block take precedence over the environment.
| Provider argument | Environment variable | Required | Description |
|---|---|---|---|
endpoint | APPWRITE_ENDPOINT | yes | Appwrite API endpoint |
project_id | APPWRITE_PROJECT_ID | no | Default project ID for resources (omit if you set project_id on each resource) |
api_key | APPWRITE_API_KEY | yes | API key with permissions for the resources you manage |
self_signed | - | no | Accept self-signed TLS certificates (Community Edition) |
http_timeout_seconds | - | no | How long to wait for a single API response. Defaults to 120 |
Request timeouts
http_timeout_seconds sets how long the provider waits for a single API response before giving up. It defaults to 120 seconds.
provider "appwrite" { endpoint = "https://<REGION>.cloud.appwrite.io/v1" project_id = "project-id" api_key = "api-key" http_timeout_seconds = 180}Some requests do their work inline rather than in the background. Updating a connection pooler restarts the sidecar, for example. A short timeout can then make Terraform report a failure for work the server already applied. This setting is separate from the waits the provider performs itself. Provisioning a dedicated database or building an index polls until the resource settles, and this timeout does not bound that.
Project scoping
You can set project_id on the provider as the default for all resources, or set project_id on individual resources when one Terraform configuration manages multiple Appwrite projects.
API keys
Use a key with the scopes required for the resources you manage (for example TablesDB, Storage, Messaging, Functions, Sites, Auth, webhooks, and backups). Follow the principle of least privilege and rotate keys stored outside Terraform.
DocumentsDB and VectorsDB do not use the TablesDB scopes (tables.*, rows.*). Each product has its own set, split by level: documentsdb.read and documentsdb.write for databases, documentsdb.collections.* for collections and indexes, and documentsdb.documents.* for documents. VectorsDB uses the same shape under vectorsdb.*.
Sensitive state
Dedicated databases export connection_string and connection_password as sensitive read-only attributes, and branches export their own credentials. Terraform writes these to state, so use a remote backend with encryption and access control, and mark any output that carries them sensitive = true.
Related
- Overview: full resource list
- TablesDB: databases, tables, columns, indexes, and rows
- Dedicated databases: PostgreSQL, MySQL, and MongoDB
- DocumentsDB and VectorsDB: document and embedding collections
- Storage: buckets and files
- Messaging: providers, topics, and subscribers
- Self-hosting: install and run the Appwrite server (not the same as configuring project resources with this provider)
Was this page helpful?
Share what worked or what we should fix. Once approved, our agents automatically apply suggested updates to the docs.