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.
_45terraform {_45 required_providers {_45 supabase = {_45 source = "supabase/supabase"_45 version = "~> 1.0"_45 }_45 }_45}_45_45provider "supabase" {_45 access_token = file("${path.module}/access-token")_45}_45_45# Define a linked project variable as user input_45variable "linked_project" {_45 type = string_45}_45_45# Import the linked project resource_45import {_45 to = supabase_project.production_45 id = var.linked_project_45}_45_45resource "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_45resource "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}