ScalixScalix Docs
Sign up

Terraform Provider

Terraform provider for Scalix Cloud to manage projects, functions, storage, and other cloud resources as infrastructure as code via terraform apply.

Overview

The Scalix Terraform provider lets you manage cloud resources as code — projects, functions, storage, and more through terraform apply.

Installation

The provider is not yet published to the Terraform Registry — publication is pending. Until it lands, install the provider binary via a local filesystem mirror (see Installation) and reference the mirror source:

hcl
terraform {
  required_providers {
    scalix = {
      source  = "registry.local/scalixworld/scalix"
      version = "~> 0.1"
    }
  }
}
 
provider "scalix" {
  token = var.scalix_token  # or set SCALIX_TOKEN env var
}

Resources

Project

hcl
resource "scalix_project" "app" {
  name = "my-app"
}

Functions

hcl
resource "scalix_function" "api" {
  name  = "api-handler"
  image = "api.scalix.world/<project-id>/api:latest"
}
 
output "function_url" {
  value = scalix_function.api.url
}

Storage

hcl
resource "scalix_storage_bucket" "assets" {
  name   = "app-assets"
  public = false
}

Cron Schedules

hcl
resource "scalix_cron_schedule" "cleanup" {
  name        = "daily-cleanup"
  expression  = "0 3 * * *"
  action_type = "function"
  action_ref  = scalix_function.api.id
}

Domains

hcl
resource "scalix_domain" "app" {
  domain = "app.example.com"
  target = scalix_run_service.api.name
}

Run Services

hcl
resource "scalix_run_service" "api" {
  name          = "api-service"
  image_ref     = "api.scalix.world/<project-id>/api:v2"
  port          = 8080
  min_instances = 0
  max_instances = 10
}

Data Sources

hcl
data "scalix_project" "existing" {
  name = "my-app"
}
 
data "scalix_health" "platform" {}
 
output "platform_status" {
  value = data.scalix_health.platform.status
}