githubEdit

cubeTerraform Provider

Manage Spice.ai resources with Terraform

The Spice.ai Terraform Providerarrow-up-right enables infrastructure-as-code management of your Spice.ai Cloud resources.

Provider Configuration

terraform {
  required_providers {
    spiceai = {
      source  = "spiceai/spiceai"
      version = "~> 0.1"
    }
  }
}

provider "spiceai" {
  # OAuth client credentials for authentication.
  # Can also be set via environment variables:
  #   SPICEAI_CLIENT_ID
  #   SPICEAI_CLIENT_SECRET
  client_id     = var.spiceai_client_id
  client_secret = var.spiceai_client_secret

  # Optional: Custom API endpoint (defaults to https://api.spice.ai)
  # api_endpoint = "https://api.spice.ai"
}

Authentication

The provider authenticates using OAuth 2.0 Client Credentials. Set credentials via environment variables:

Create OAuth clients in the Spice.ai Portalarrow-up-right under SettingsOAuth Clients.

Resources

spiceai_app

Manages a Spice.ai application.

Arguments:

Argument
Type
Required
Description

name

string

Yes

App name (min 4 chars, alphanumeric and hyphens)

cname

string

Yes

Region identifier (from spiceai_regions)

description

string

No

App description

visibility

string

No

public or private (default: private)

spicepod

string

No

Spicepod configuration (YAML or JSON string)

image_tag

string

No

Spice runtime version tag

replicas

number

No

Number of replicas (1-10)

region

string

No

AWS region code

production_branch

string

No

Git branch for production deployments

node_group

string

No

Kubernetes node group

storage_claim_size_gb

number

No

Persistent volume size in GB

Attributes:

Attribute
Description

id

App ID

api_key

Primary API key

You can use JSON instead of YAML for the spicepod:

Or use a template file:

spiceai_deployment

Creates a deployment for a Spice.ai app.

Arguments:

Argument
Type
Required
Description

app_id

string

Yes

The app ID to deploy

image_tag

string

No

Override the Spice runtime image tag

replicas

number

No

Override the number of replicas (1-10)

debug

boolean

No

Enable debug mode

branch

string

No

Git branch name (for tracking)

commit_sha

string

No

Git commit SHA (for tracking)

commit_message

string

No

Git commit message (for tracking)

Attributes:

Attribute
Description

id

Deployment ID

status

Deployment status (queued, in_progress, succeeded, failed)

Use triggers to automatically create a new deployment when the app configuration changes:

spiceai_secret

Manages secrets for a Spice.ai app.

Arguments:

Argument
Type
Required
Description

app_id

string

Yes

The app ID

name

string

Yes

Secret name

value

string

Yes

Secret value (sensitive)

Attributes:

Attribute
Description

id

Secret ID

circle-info

After importing a secret, you must set the value attribute in your configuration since secret values are not returned by the API (they are masked).

spiceai_member

Manages organization members.

Arguments:

Argument
Type
Required
Description

username

string

Yes

GitHub username

roles

string[]

No

Roles to assign (default: ["member"])

Attributes:

Attribute
Description

user_id

User ID

circle-exclamation

Data Sources

spiceai_regions

Lists available deployment regions.

spiceai_container_images

Lists available Spice runtime container images.

spiceai_app

Gets details about an existing app by ID.

spiceai_apps

Lists all apps in the organization.

spiceai_members

Lists all organization members.

spiceai_secrets

Lists secrets for an app (values are masked).

Import

Import existing resources into Terraform state:

Complete Example

A full working example that creates an app with secrets, deploys it, and manages team members:

Resource Mapping

Terraform Resource
API Endpoints

spiceai_app

POST/GET/PUT/DELETE /v1/apps/{appId}

spiceai_deployment

POST/GET /v1/apps/{appId}/deployments

spiceai_secret

GET/POST/DELETE /v1/apps/{appId}/secrets

spiceai_member

GET/POST/PATCH/DELETE /v1/members

spiceai_regions

GET /v1/regions

spiceai_container_images

GET /v1/container-images

spiceai_app (data)

GET /v1/apps/{appId}

spiceai_apps (data)

GET /v1/apps

spiceai_members (data)

GET /v1/members

spiceai_secrets (data)

GET /v1/apps/{appId}/secrets

See also:

Last updated

Was this helpful?