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
| Attribute | Description | Type | Optional | Sensitive |
|---|---|---|---|---|
| access_token | Supabase access token. Can also be set via the | string | true | true |
| endpoint | Supabase API endpoint. Can also be set via the | string | true |
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
| Attribute | Description | Type | Required | Optional | Read-only |
|---|---|---|---|---|---|
api_key | API key | string | true | ||
description | Description of the API key | string | true | ||
id | API key identifier | string | true | ||
name | Name of the API key | string | true | ||
project_ref | Project reference ID | string | true | ||
secret_jwt_template | Secret JWT template | true | |||
type | Type of the API key | string | true |
Example usage
1resource "supabase_branch" "<label>" {
2 git_branch = ""
3 parent_project_ref = ""
4 region = ""
5}Details
| Attribute | Description | Type | Required | Optional | Read-only |
|---|---|---|---|---|---|
database | Database connection details | true | |||
git_branch | Git branch | string | true | ||
id | Branch identifier | string | true | ||
parent_project_ref | Parent project ref | string | true | ||
persistent | Branch persistency | bool | true | true | |
region | Database region | string | true |
Example usage
1resource "supabase_edge_function" "<label>" {
2 entrypoint = ""
3 import_map = ""
4 project_ref = ""
5 slug = ""
6 static_files = <value>
7}Details
| Attribute | Description | Type | Required | Optional | Read-only |
|---|---|---|---|---|---|
checksum | SHA256 checksum of the deployed function bundle (remote) | string | true | ||
created_at | Timestamp when the function was created | number | true | ||
entrypoint | Path to the function entrypoint file | string | true | ||
id | Function identifier | string | true | ||
import_map | Path to the import map file | string | true | ||
local_checksum | SHA256 checksum of local source files before upload | string | true | ||
name | Name of the function (defaults to slug if not specified) | string | true | true | |
project_ref | Project ref | string | true | ||
slug | URL-friendly identifier for the function | string | true | ||
static_files | List of glob patterns for static files to include | liststring | true | ||
status | Function deployment status | string | true | ||
updated_at | Timestamp when the function was last updated | number | true | ||
version | Currently deployed function version | number | true |
Example usage
1resource "supabase_edge_function_secrets" "<label>" {
2 project_ref = ""
3 secrets = <value>
4}Details
| Attribute | Description | Type | Required | Optional | Read-only |
|---|---|---|---|---|---|
id | Project identifier | string | true | ||
project_ref | Project reference ID | string | true | ||
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. | mapstring | true | ||
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
| Attribute | Description | Type | Required | Optional | Read-only |
|---|---|---|---|---|---|
database_password | Password for the project database | string | true | ||
id | Project identifier | string | true | ||
instance_size | Desired instance size of the project | string | true | true | |
legacy_api_keys_enabled | Controls whether | bool | true | true | |
name | Name of the project | string | true | ||
organization_id | Organization slug (found in the Supabase dashboard URL or organization settings) | string | true | ||
region | Region where the project is located | string | true |
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
| Attribute | Description | Type | Required | Optional | Read-only |
|---|---|---|---|---|---|
api | API settings as serialised JSON | string | true | ||
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 Affected fields: | string | true | ||
database | Database settings as serialised JSON | string | true | ||
id | Project identifier | string | true | ||
network | Network settings as serialised JSON | string | true | ||
pooler | Pooler settings as serialised JSON | string | true | ||
project_ref | Project reference ID | string | true | ||
ssl_enforcement | Enforce SSL on all database connections. See the SSL enforcement API. | bool | true | ||
storage | Storage settings as serialised JSON | string | true |
Example usage
1resource "supabase_third_party_auth" "<label>" {
2 custom_jwks = ""
3 jwks_url = ""
4 oidc_issuer_url = ""
5 project_ref = ""
6}Details
| Attribute | Description | Type | Required | Optional | Read-only |
|---|---|---|---|---|---|
custom_jwks | Custom public JWKS as serialised JSON. Exactly one of | string | true | ||
id | Third-party auth integration identifier | string | true | ||
inserted_at | Timestamp when the integration was created | string | true | ||
jwks_url | JWKS URL. Exactly one of | string | true | ||
oidc_issuer_url | OIDC issuer URL. Exactly one of | string | true | ||
project_ref | Project reference ID | string | true | ||
resolved_at | Timestamp when JWKS was last resolved | string | true | ||
resolved_jwks | Resolved JWKS as serialised JSON | string | true | ||
type | Third-party auth integration type | string | true | ||
updated_at | Timestamp when the integration was last updated | string | true |
Data sources
You can read these resources using the Supabase Terraform provider:
Example usage
1resource "supabase_apikeys" "all" {
2 project_ref = ""
3}Details
| Attribute | Description | Type | Required | Optional | Read-only |
|---|---|---|---|---|---|
anon_key | Anonymous API key for the project | string | true | ||
project_ref | Project reference ID | string | true | ||
publishable_key | Publishable API key for the project | string | true | ||
secret_keys | List of secret API keys for the project | true | |||
service_role_key | Service role API key for the project | string | true |
Example usage
1resource "supabase_branch" "all" {
2 parent_project_ref = ""
3}Details
| Attribute | Description | Type | Required | Optional | Read-only |
|---|---|---|---|---|---|
branches | Branch databases | true | |||
parent_project_ref | Parent project ref | string | true |