- DATE:
- AUTHOR:
- PowerSync Product Team
An Official Terraform Provider for PowerSync
We released an official Terraform provider, so you can manage your PowerSync Cloud projects and instances as Infrastructure-as-Code instead of configuring them by hand in the Dashboard.
When you'd use it
This provider is useful if you want to manage your PowerSync Cloud instance with Terraform's Infrastructure-as-Code approach, or you're already running Terraform for other parts of your stack and want PowerSync to live alongside it instead of as a separate workflow. It allows you to:
Provision PowerSync alongside the rest of your stack. Create your PowerSync instance in the same
terraform applythat sets up your database, networking, and supporting services, rather than clicking through the Dashboard as a separate step.Keep
dev/staging/prodconsistent. Define an instance once and parameterize it with variables, so every environment is configured the same way.Review infrastructure changes in PRs. Changes to sync config, database connection settings, and auth settings show up as Terraform plan diffs in Git, so they go through the same review as the rest of your infrastructure.
Recreate environments reproducibly. Version-controlled Terraform configuration becomes a repeatable source of truth you can recreate an environment from.
Note that this provider manages PowerSync Cloud specifically, so it doesn't apply to self-hosted deployments. If you self-host, you already define your setup as code through powersync.yaml, and you can provision the underlying infrastructure and data sources with their own Terraform providers (AWS, Google Cloud, Azure, MongoDB Atlas, Supabase, etc.).
What it manages
The provider exposes two resources:
powersync_project: a PowerSync project within your organization.powersync_instance: an instance, combining its replication connection, client authentication (JWKS), and sync configuration (your Sync Streams definition).
A minimal configuration looks like this:
terraform {
required_providers {
powersync = {
source = "powersync-ja/powersync"
version = "~> 0.1"
}
}
}
provider "powersync" {}
data "powersync_organization" "main" {
id = "64b3f8e1a2c4d5e6f7080912"
}
resource "powersync_project" "main" {
org_id = data.powersync_organization.main.id
name = "My Project"
region = "eu"
}
resource "powersync_instance" "production" {
org_id = data.powersync_organization.main.id
project_id = powersync_project.main.id
name = "production"
replication_connection {
type = "postgresql"
name = "main"
hostname = "db.example.com"
port = 5432
database = "postgres"
username = "powersync_role"
password = var.replication_password
sslmode = "verify-full"
}
client_auth {
jwks_uri = "https://auth.example.com/.well-known/jwks.json"
allow_temporary_tokens = false
}
sync_config_content = file("${path.module}/sync-config.yaml")
}
variable "replication_password" {
type = string
sensitive = true
}replication_connection supports postgresql, mongodb, mysql, and mssql source types, each with its own fields. Sync configuration is YAML, so you can load it from a file as above or keep it inline. Instances can be provisioned in any of the available PowerSync Cloud regions, currently eu, us, jp, au, and br.
Getting started
See our Terraform docs for a walkthrough, and the provider docs for a full reference. The repo also has runnable examples/: each is a self-contained directory you can cd into and terraform apply, covering every resource and data source the provider exposes.
Need help? Have feedback?
We added this provider in response to repeated requests from customers and the community. If you have any questions or feedback about it, chat with us and the PowerSync community on Discord. Issues and PRs are also very welcome on GitHub.