DEV Community

Alex Spinov
Alex Spinov

Posted on

Spacelift Has a Free API: GitOps-Native Infrastructure Management for Teams

What is Spacelift?

Spacelift is a CI/CD platform for infrastructure-as-code supporting Terraform, OpenTofu, Pulumi, CloudFormation, Ansible, and Kubernetes. It solves IaC at scale: state management, policy enforcement, drift detection, and multi-team collaboration.

Why Spacelift?

  • Free tier — 1 worker, unlimited private repos, up to 10 stacks
  • Multi-IaC — Terraform, OpenTofu, Pulumi, CloudFormation, Ansible, K8s in one platform
  • Policy as Code — OPA/Rego policies for plan approval, resource restrictions
  • Drift detection — scheduled runs detect and optionally auto-remediate drift
  • Contexts — reusable environment configs shared across stacks

Quick Start

curl -fsSL https://downloads.spacelift.io/spacectl/latest/spacectl_linux_amd64 -o spacectl
chmod +x spacectl && sudo mv spacectl /usr/local/bin/
spacectl profile login https://your-account.app.spacelift.io
Enter fullscreen mode Exit fullscreen mode

Stack Configuration

version: 1
stack_defaults:
  terraform_version: "1.7.0"
  autodeploy: true
  before_init:
    - terraform fmt -check
stacks:
  production:
    project_root: terraform/production
    branch: main
    autodeploy: true
    labels:
      - env:production
      - team:platform
  staging:
    project_root: terraform/staging
    branch: main
    autodeploy: true
Enter fullscreen mode Exit fullscreen mode

Policy as Code with OPA

package spacelift

deny[reason] {
    resource := input.terraform.resource_changes[_]
    resource.change.actions[_] == "create"
    not resource.change.after.tags.Environment
    reason := sprintf("Resource %s must have Environment tag", [resource.address])
}
Enter fullscreen mode Exit fullscreen mode

Drift Detection

stacks:
  production:
    schedule:
      drift:
        cron: "0 */6 * * *"
        reconcile: false
        timezone: UTC
Enter fullscreen mode Exit fullscreen mode

Spacelift vs Alternatives

Feature Spacelift Terraform Cloud Env0 Atlantis
Multi-IaC Yes TF only TF, Pulumi TF only
Free tier 10 stacks 500 resources 5 users Self-host
Policy engine OPA Sentinel OPA None
Drift detection Built-in Paid Built-in None

Real-World Impact

An e-commerce company with 80 Terraform stacks had no policy enforcement with Atlantis. After Spacelift: OPA policies block risky changes, drift detection catches console changes, infra incidents dropped 70%.


Managing infrastructure at scale? I help teams set up IaC pipelines with policies and drift detection. Contact spinov001@gmail.com or check my automation tools on Apify.

Top comments (0)