A Pulumi package for creating and managing SupavisorNative resources.
Project description
Pulumi Native Provider for Supavisor
Supavisor is a cloud-native, multi-tenant Postgres connection pooler developed by Supabase. This Pulumi provider allows you to manage Supavisor tenants and their configurations using infrastructure as code.
This provider was generated using an upgraded pulschema and pulumi-provider-framework.
Package SDKs
- Node.js: https://www.npmjs.com/package/@phillarson-xyz/pulumi-supavisor-native
- Python: https://pypi.org/project/pulumi-supavisor-native/
- .NET: https://www.nuget.org/packages/Pulumi.SupavisorNative
- Go:
import github.com/phillarson-xyz/pulumi-supavisor-native/sdk/go/supavisor-native
Using The Provider
Change the URL in provider/cmd/provider-gen-supavisor-native/openapi.yml
to your url. You'll also need to configure the provider with your Supavisor JWT secret. Set it as a secret using:
pulumi config set --secret supavisor:jwtSecret <your-jwt-secret>
The JWT secret can also be set via the SUPAVISOR_NATIVE_JWT_SECRET
environment variable or passed in as any pulumi.Input
such as a stack reference.
Basic Usage
Here's a basic example of creating a Supavisor tenant. The provider will use the JWT secret to sign a new auth token JWT that lasts for five minutes.
import pulumi_supavisor_native as supavisor
# Configure the provider
provider = supavisor.Provider(
"supavisor",
jwt_secret="supavisor-jwt-secret",
)
# Create a tenant
tenant = supavisor.tenants.Tenant(
"supavisor-tenant",
external_id="unique-tenant-id-for-url",
tenant=supavisor.tenants.TenantPropertiesArgs(
db_host="upstream-postgres-url",
db_port="upstream-postgres-port",
db_database="upstream-postgres-db",
external_id="same-unique-tenant-id",
ip_version="auto",
enforce_ssl=False,
upstream_ssl=False,
require_user=True,
auth_query="SELECT rolname, rolpassword FROM pg_authid WHERE rolname=$1;",
users=[
supavisor.tenants.UserArgs(
db_password="upstream-postgres-password",
db_user="upstream-postgres-user",
pool_size=20,
mode_type="transaction",
is_manager=False,
)
],
)
)
Resource Types
The provider currently supports the following resource types:
supavisor:tenants:Tenant
: Manages Supavisor tenantssupavisor:Provider
: Configures the Supavisor provider
Tenant Configuration Options
When creating a tenant, you can configure the following options:
Required Fields
external_id
: Unique identifier for the tenantdb_host
: Upstream Postgres hostdb_port
: Upstream Postgres port (integer)db_database
: Database namerequire_user
: Whether to require user authenticationusers
: List of database users (at least one user required)
Optional Fields
allow_list
: List of CIDR addresses (defaults to["0.0.0.0/0", "::/0"]
)auth_query
: Custom authentication query (defaults toSELECT rolname, rolpassword FROM pg_authid WHERE rolname=$1
)ip_version
: IP version ("auto", "4", or "6")enforce_ssl
: Enable SSL for client connections (default: false)upstream_ssl
: Enable SSL for upstream connections (default: true)upstream_verify
: SSL verification mode (e.g., "none")sni_hostname
: SNI hostname for SSL connections (e.g., "your.domain.com")
User Configuration Options
Each user in the users
array supports the following options:
Required Fields
db_user
: Database usernamedb_password
: Database passwordpool_size
: Number of connections in the pool (integer)
Optional Fields
db_user_alias
: Alternative username for the connectionis_manager
: Whether the user has manager privileges (default: false)max_clients
: Maximum number of allowed clients (default: 25000)mode_type
: Pool mode type ("transaction" or "session")pool_checkout_timeout
: Timeout for checking out connections from the pool (in milliseconds)tenant_external_id
: External ID reference for the tenant
Read-only Fields
The following fields are read-only and will be populated after resource creation:
id
: Resource identifierinserted_at
: Creation timestampupdated_at
: Last update timestamp
Importing Existing Resources
To import an existing Supavisor tenant, use:
pulumi import supavisor:tenants:Tenant {resourceName} {external_id}
Alternatively, you can use the import
option in your Pulumi program:
tenant = supavisor.tenants.Tenant(
"existing-tenant",
external_id="unique-tenant-id",
tenant=supavisor.tenants.TenantPropertiesArgs(...),
opts=pulumi.ResourceOptions(import_="unique-tenant-id")
)
Functions
The provider includes the following utility functions:
getTenant(external_id: string)
: Retrieve a tenant by its external ID
Contributing
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
License
Apache-2.0 License
About Supavisor
Supavisor is a cloud-native, multi-tenant Postgres connection pooler that provides:
- Connection pooling
- Multi-tenancy support
- Authentication and authorization
- SSL/TLS support
- High availability
- Monitoring and metrics
For more information about Supavisor, visit the official repository.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pulumi_supavisor_native-0.0.6.tar.gz
.
File metadata
- Download URL: pulumi_supavisor_native-0.0.6.tar.gz
- Upload date:
- Size: 16.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
de9c3561e6f341a4efbc175606e71b563e73688be37f5f36b9c3af686a36282e
|
|
MD5 |
344a9b0e614130649e6dd9ea155b0f79
|
|
BLAKE2b-256 |
b527e32f3ecd348764149c2971e750b8274be2022a644f44c2ab55f32ce4dce1
|
File details
Details for the file pulumi_supavisor_native-0.0.6-py3-none-any.whl
.
File metadata
- Download URL: pulumi_supavisor_native-0.0.6-py3-none-any.whl
- Upload date:
- Size: 20.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
4231058893a478a839ce803defadf30e832e948e67a569728d0864a11623bdde
|
|
MD5 |
9d63c828fc1fbbad37a793a5b798dcd0
|
|
BLAKE2b-256 |
eb6eaf7389a81f8140bdd574a9db4ae4f217529668a551270b09e44c529a0938
|