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.
1terraform {2 required_providers {3 supabase = {4 source = "supabase/supabase"5 version = "~> 1.0"6 }7 }8}910provider "supabase" {11 access_token = file("${path.module}/access-token")12}1314# Define a linked project variable as user input15variable "linked_project" {16 type = string17}1819# Import the linked project resource20import {21 to = supabase_project.production22 id = var.linked_project23}2425resource "supabase_project" "production" {26 organization_id = "nknnyrtlhxudbsbuazsu"27 name = "tf-project"28 database_password = "tf-example"29 region = "ap-southeast-1"3031 lifecycle {32 ignore_changes = [database_password]33 }34}3536# Configure api settings for the linked project37resource "supabase_settings" "production" {38 project_ref = var.linked_project3940 api = jsonencode({41 db_schema = "public,storage,graphql_public"42 db_extra_search_path = "public,extensions"43 max_rows = 100044 })45}