Skip to main content
Use the Terraform provider to manage control plane resources. The provider supports:
  • Resources
    • s2_basin
    • s2_stream
    • s2_access_token
  • Data sources
    • s2_basin
    • s2_stream
    • s2_locations
    • s2_default_location
resource blocks are managed by Terraform (create/update/delete).
data blocks are read-only lookups for existing resources.

Prerequisites

  • Terraform >= 1.5.0
  • An S2 access token (S2_ACCESS_TOKEN)

Quickstart

1

Set your credentials

2

Create a Terraform config

3

Initialize and apply

Authentication and Endpoint Configuration

You can configure credentials in provider config or through environment variables:
Environment variables:
  • S2_ACCESS_TOKEN
  • S2_ACCOUNT_ENDPOINT (optional)
  • S2_BASIN_ENDPOINT (optional, supports {basin} placeholder e.g. {basin}.b.s2.dev)

Locations and storage classes

Use s2_locations to check available locations and their storage classes. Use s2_default_location for the account’s default location.
Choose a class available in the basin’s location. See storage-class selection and defaults.

Resource Examples

Basin with defaults

Stream config

Scoped access token

The issued token value is marked as sensitive, but still lives in Terraform state.

Import Existing Infrastructure

Import formats:
  • Basin: <basin-name>
  • Stream: <basin-name>/<stream-name>
  • Access token: <token-id>
Examples:

Using with s2-lite

When targeting s2-lite, set the account endpoint:
Access-token API is not supported with s2-lite.
  1. Pin a provider version in required_providers.
  2. Commit .terraform.lock.hcl.
  3. Use terraform plan to preview changes before applying.
  4. Use terraform import for existing resources rather than recreating.