Platform

Terraform Provider

Supabase Terraform Provider

The Supabase Provider allows Terraform to manage resources hosted on Supabase platform.

You may use this provider to version control your project settings or setup CI/CD pipelines for automatically provisioning projects and branches.

Using the provider

This simple example imports an existing Supabase project and synchronises its API settings.


_45
terraform {
_45
required_providers {
_45
supabase = {
_45
source = "supabase/supabase"
_45
version = "~> 1.0"
_45
}
_45
}
_45
}
_45
_45
provider "supabase" {
_45
access_token = file("${path.module}/access-token")
_45
}
_45
_45
# Define a linked project variable as user input
_45
variable "linked_project" {
_45
type = string
_45
}
_45
_45
# Import the linked project resource
_45
import {
_45
to = supabase_project.production
_45
id = var.linked_project
_45
}
_45
_45
resource "supabase_project" "production" {
_45
organization_id = "nknnyrtlhxudbsbuazsu"
_45
name = "tf-project"
_45
database_password = "tf-example"
_45
region = "ap-southeast-1"
_45
_45
lifecycle {
_45
ignore_changes = [database_password]
_45
}
_45
}
_45
_45
# Configure api settings for the linked project
_45
resource "supabase_settings" "production" {
_45
project_ref = var.linked_project
_45
_45
api = jsonencode({
_45
db_schema = "public,storage,graphql_public"
_45
db_extra_search_path = "public,extensions"
_45
max_rows = 1000
_45
})
_45
}