A Terraform provider for managing Appwrite resources. Works with both Appwrite Cloud and Community Edition.
Appwrite Cloud:
terraform {
required_providers {
appwrite = {
source = "appwrite/appwrite"
}
}
}
provider "appwrite" {
endpoint = "https://cloud.appwrite.io/v1"
project_id = "project-id"
api_key = "api-key"
}All provider attributes can also be set via environment variables:
export APPWRITE_ENDPOINT="https://cloud.appwrite.io/v1"
export APPWRITE_PROJECT_ID="project-id"
export APPWRITE_API_KEY="api-key"If an environment variable is provided, then the option does not need to be set in the terraform provider configuration.
| Property | Environment Variable | Required | Description |
|---|---|---|---|
| endpoint | APPWRITE_ENDPOINT |
yes | The Appwrite API endpoint |
| project_id | APPWRITE_PROJECT_ID |
yes | The Appwrite project ID |
| api_key | APPWRITE_API_KEY |
yes | The Appwrite API key |
| self_signed | — | no | Accept self-signed certificates (for community edition) |
| Resource | Description |
|---|---|
appwrite_tablesdb |
Database |
appwrite_tablesdb_table |
Database table |
appwrite_tablesdb_column |
Table column |
appwrite_tablesdb_index |
Table index |
appwrite_tablesdb_row |
Table row |
appwrite_storage_bucket |
Storage bucket |
appwrite_backup_policy |
Backup policy |
appwrite_messaging_provider |
Messaging provider |
appwrite_messaging_topic |
Messaging topic |
appwrite_auth_user |
User |
appwrite_auth_team |
Team |
| Data Source | Description |
|---|---|
appwrite_tablesdb |
Look up a tablesdb by identifier |
resource "appwrite_tablesdb" "main" {
id = "main"
name = "main"
}
resource "appwrite_tablesdb_table" "users" {
database_id = appwrite_tablesdb.main.id
id = "users"
name = "users"
}
resource "appwrite_tablesdb_column" "name" {
database_id = appwrite_tablesdb.main.id
table_id = appwrite_tablesdb_table.users.id
key = "name"
type = "varchar"
size = 255
required = true
}
resource "appwrite_storage_bucket" "images" {
id = "images"
name = "images"
maximum_file_size = 10485760
allowed_file_extensions = ["jpg", "png", "webp", "gif"]
compression = "gzip"
transformations = true
}
resource "appwrite_messaging_provider" "sendgrid" {
id = "sendgrid"
name = "sendgrid"
type = "sendgrid"
api_key = "SG.test"
from_email = "noreply@example.com"
from_name = "application"
}make build # build the provider
make install # install to local terraform plugins
make test # run unit tests
make acceptance-test # run acceptance tests (requires Appwrite credentials)
make lint # run go vet + format check
make fmt # format all go files
make clean # remove built binaryFor local development, add a dev override to ~/.terraformrc:
provider_installation {
dev_overrides {
"appwrite/appwrite" = "/path/to/terraform-provider"
}
direct {}
}