horkos 0.1.2

Cloud infrastructure language where insecure code won't compile
Documentation

Horkos

Cloud infrastructure code that won't let you deploy insecure configurations

License

A type-safe language for cloud infrastructure that compiles to Terraform. Security is enforced at compile time.

The Idea

// One line of Horkos:
val bucket = S3.createBucket("my-data")

// Generates Terraform with secure defaults:
// ✓ AES256 encryption
// ✓ Versioning enabled  
// ✓ Public access blocked

Weakening security requires explicit justification:

// Won't compile:
val bad = S3.createBucket("data", publicAccess: true)  // ❌

// Must be explicit:
val public = unsafe("APPROVED: Static website - ticket #402") {
    S3.createBucket("website", publicAccess: true)  // ✅
}

Quick Start

# Install
cargo install horkos

# Create a new project
horkos init my-infra
cd my-infra

# Compile to Terraform (finds src/main.hk automatically)
horkos compile

# Apply with Terraform
cd terraform && terraform apply

Project Structure

my-infra/
├── src/
│   ├── main.hk              # Entry point (convention)
│   └── network/
│       └── vpc.hk           # Importable module
└── terraform/               # Generated output
    ├── main.tf              # Provider config
    ├── resources.tf         # From src/main.hk
    └── network/
        └── vpc.tf           # From src/network/vpc.hk

Multi-File Example

// src/network/vpc.hk
val logBucket = S3.createBucket("vpc-logs")
val mainVpc = Network.createVpc("main", cidr: "10.0.0.0/16", flowLogs: logBucket)
// src/main.hk
import "./network/vpc.hk" as network

val sg = Network.createSecurityGroup(vpc: network.mainVpc, name: "web")
val bucket = S3.createBucket("app-data")
$ horkos compile

Discovering project in /my-infra
  Found 2 file(s)
    src/network/vpc.hk
    src/main.hk
Compiling src/network/vpc.hk
Compiling src/main.hk

Wrote 3 file(s):
    main.tf
    network/vpc.tf
    resources.tf

Why Horkos?

Problem Other Tools Horkos
Security Opt-in (easy to forget) Enforced (can't forget)
When errors caught CI/runtime (too late) Compile time (before commit)
Type safety None or unsound Full type checking
Legacy code Trust it blindly Marked as Unverified<T>
Cross-file types N/A Shared across imports

Current Status

v0.1.2 - Alpha

✅ S3, VPC, Subnets, Security Groups
✅ Taint tracking with Unverified<T>
unsafe blocks with mandatory justifications
✅ Multi-file projects with cross-file type sharing
✅ Per-file Terraform output
✅ Rich error messages with error codes

See ROADMAP for planned features.

Documentation

License

MIT OR Apache-2.0

Origin

In Greek mythology, Horkos punished oath-breakers swiftly. Here, your infrastructure declarations are oaths—break them and the compiler stops you.