Skip to content

Updated

Terraform Provider reference

Resources and data sources available through the Terraform Provider

The Terraform Provider provides access to resources and data sources. Resources are infrastructure objects, such as a Supabase project, that you can declaratively configure. Data sources are sources of information about your Supabase instances.

Provider settings

Use these settings to configure your Supabase provider and authenticate to your Supabase project.

Example usage

1provider "supabase" {
2    access_token = ""
3    endpoint = ""
4}

Details

AttributeDescriptionTypeOptionalSensitive
access_token

Supabase access token. Can also be set via the SUPABASE_ACCESS_TOKEN environment variable. When both are specified, the provider configuration takes precedence over the environment variable. Generate a token from the Supabase Dashboard.

stringtruetrue
endpoint

Supabase API endpoint. Can also be set via the SUPABASE_API_ENDPOINT environment variable. If neither is set, defaults to https://api.supabase.com. When both are specified, the provider configuration takes precedence over the environment variable.

stringtrue

Resources

You can configure these resources using the Supabase Terraform provider:

Example usage

1resource "supabase_apikey" "<label>" {
2    description = ""
3    name = ""
4    project_ref = ""
5}

Details

AttributeDescriptionTypeRequiredOptionalRead-only
api_key

API key

stringtrue
description

Description of the API key

stringtrue
id

API key identifier

stringtrue
name

Name of the API key

stringtrue
project_ref

Project reference ID

stringtrue
secret_jwt_template

Secret JWT template

true
type

Type of the API key

stringtrue

Example usage

1resource "supabase_branch" "<label>" {
2    git_branch = ""
3    parent_project_ref = ""
4    region = ""
5}

Details

AttributeDescriptionTypeRequiredOptionalRead-only
database

Database connection details

true
git_branch

Git branch

stringtrue
id

Branch identifier

stringtrue
parent_project_ref

Parent project ref

stringtrue
persistent

Branch persistency

booltruetrue
region

Database region

stringtrue

Example usage

1resource "supabase_edge_function" "<label>" {
2    entrypoint = ""
3    import_map = ""
4    project_ref = ""
5    slug = ""
6    static_files = <value>
7}

Details

AttributeDescriptionTypeRequiredOptionalRead-only
checksum

SHA256 checksum of the deployed function bundle (remote)

stringtrue
created_at

Timestamp when the function was created

numbertrue
entrypoint

Path to the function entrypoint file

stringtrue
id

Function identifier

stringtrue
import_map

Path to the import map file

stringtrue
local_checksum

SHA256 checksum of local source files before upload

stringtrue
name

Name of the function (defaults to slug if not specified)

stringtruetrue
project_ref

Project ref

stringtrue
slug

URL-friendly identifier for the function

stringtrue
static_files

List of glob patterns for static files to include

liststringtrue
status

Function deployment status

stringtrue
updated_at

Timestamp when the function was last updated

numbertrue
version

Currently deployed function version

numbertrue

Example usage

1resource "supabase_edge_function_secrets" "<label>" {
2    project_ref = ""
3    secrets = <value>
4}

Details

AttributeDescriptionTypeRequiredOptionalRead-only
id

Project identifier

stringtrue
project_ref

Project reference ID

stringtrue
secret_digests

Map of secret name to the SHA-256 hex digest of the secret value. Computed by the provider at plan time (when plaintext values are known) and updated after each apply. Used to detect drift when a secret has been changed outside of Terraform: if the digest returned by the API no longer matches the locally computed digest, the provider marks the affected secret value as null so Terraform will plan an update.

mapstringtrue
secrets

Set of secrets for edge functions

true

Example usage

1resource "supabase_project" "<label>" {
2    database_password = ""
3    name = ""
4    organization_id = ""
5    region = ""
6}

Details

AttributeDescriptionTypeRequiredOptionalRead-only
database_password

Password for the project database

stringtrue
id

Project identifier

stringtrue
instance_size

Desired instance size of the project

stringtruetrue
legacy_api_keys_enabled

Controls whether anon and service_role JWT-based api keys should be enabled. Please note: these keys are no longer recommended (more information here).

booltruetrue
name

Name of the project

stringtrue
organization_id

Organization slug (found in the Supabase dashboard URL or organization settings)

stringtrue
region

Region where the project is located

stringtrue

Example usage

1resource "supabase_settings" "<label>" {
2    api = ""
3    auth = ""
4    database = ""
5    network = ""
6    pooler = ""
7    project_ref = ""
8    ssl_enforcement = <value>
9    storage = ""
10}

Details

AttributeDescriptionTypeRequiredOptionalRead-only
api

API settings as serialised JSON

stringtrue
auth

Auth settings as serialised JSON.

~> Several fields are returned as a hash by the API rather than plaintext. The provider preserves these fields from prior state, so out-of-band changes will not appear in terraform plan.

Affected fields: smtp_pass, sms_twilio_auth_token, sms_twilio_verify_auth_token, sms_messagebird_access_key, sms_textlocal_api_key, sms_vonage_api_secret, security_captcha_secret, external_apple_secret, external_azure_secret, external_bitbucket_secret, external_discord_secret, external_facebook_secret, external_figma_secret, external_github_secret, external_gitlab_secret, external_google_secret, external_kakao_secret, external_keycloak_secret, external_linkedin_oidc_secret, external_notion_secret, external_slack_oidc_secret, external_slack_secret, external_spotify_secret, external_twitch_secret, external_twitter_secret, external_workos_secret, external_x_secret, external_zoom_secret, hook_custom_access_token_secrets, hook_mfa_verification_attempt_secrets, hook_password_verification_attempt_secrets, hook_send_email_secrets, hook_send_sms_secrets.

stringtrue
database

Database settings as serialised JSON

stringtrue
id

Project identifier

stringtrue
network

Network settings as serialised JSON

stringtrue
pooler

Pooler settings as serialised JSON

stringtrue
project_ref

Project reference ID

stringtrue
ssl_enforcement

Enforce SSL on all database connections. See the SSL enforcement API.

booltrue
storage

Storage settings as serialised JSON

stringtrue

Example usage

1resource "supabase_third_party_auth" "<label>" {
2    custom_jwks = ""
3    jwks_url = ""
4    oidc_issuer_url = ""
5    project_ref = ""
6}

Details

AttributeDescriptionTypeRequiredOptionalRead-only
custom_jwks

Custom public JWKS as serialised JSON. Exactly one of oidc_issuer_url, jwks_url, or custom_jwks must be configured. This field follows Terraform provider industry practice for public verification keys and is not marked sensitive; do not include private or symmetric JWK material.

stringtrue
id

Third-party auth integration identifier

stringtrue
inserted_at

Timestamp when the integration was created

stringtrue
jwks_url

JWKS URL. Exactly one of oidc_issuer_url, jwks_url, or custom_jwks must be configured.

stringtrue
oidc_issuer_url

OIDC issuer URL. Exactly one of oidc_issuer_url, jwks_url, or custom_jwks must be configured.

stringtrue
project_ref

Project reference ID

stringtrue
resolved_at

Timestamp when JWKS was last resolved

stringtrue
resolved_jwks

Resolved JWKS as serialised JSON

stringtrue
type

Third-party auth integration type

stringtrue
updated_at

Timestamp when the integration was last updated

stringtrue

Data sources

You can read these resources using the Supabase Terraform provider:

Example usage

1resource "supabase_apikeys" "all" {
2    project_ref = ""
3}

Details

AttributeDescriptionTypeRequiredOptionalRead-only
anon_key

Anonymous API key for the project

stringtrue
project_ref

Project reference ID

stringtrue
publishable_key

Publishable API key for the project

stringtrue
secret_keys

List of secret API keys for the project

true
service_role_key

Service role API key for the project

stringtrue

Example usage

1resource "supabase_branch" "all" {
2    parent_project_ref = ""
3}

Details

AttributeDescriptionTypeRequiredOptionalRead-only
branches

Branch databases

true
parent_project_ref

Parent project ref

stringtrue

Example usage

1resource "supabase_network_bans" "all" {
2    project_ref = ""
3}

Details

AttributeDescriptionTypeRequiredOptionalRead-only
banned_ipv4_addresses

List of banned IPv4 addresses

setstringtrue
project_ref

Project reference ID

stringtrue

Example usage

1resource "supabase_pooler" "all" {
2    project_ref = ""
3}

Details

AttributeDescriptionTypeRequiredOptionalRead-only
project_ref

Project ref

stringtrue
url

Map of pooler mode to connection string

mapstringtrue