small-config¶
Python-first IaC orchestration. Run Terraform, Ansible, and shell commands as a single coherent stack — with environment isolation, secrets management, dependency ordering, and built-in HTTP smoke tests.
# config.py
from small_config import HttpTest, Project, ProjectConfig, TerraformComponent, sc
class AppConfig(ProjectConfig):
default_env = "dev"
def project(self, env: str) -> Project:
infra = TerraformComponent(
name="infra",
vars={"project_id": "my-gcp-project", "ssh_pub_key": sc.secret("ssh_pub_key")},
)
return Project(
name="my-app",
env=env,
components=[infra],
tests=[
HttpTest(
name="api health",
url=infra.output("ip", transform=lambda ip: f"http://{ip}:8000"),
expect_status=200,
),
],
)
CONFIG = AppConfig()
sc build # deploy infra + run smoke tests
sc destroy # tear everything down
sc build -e prod # target a different environment
Why small-config?¶
| Problem | small-config answer |
|---|---|
| Terraform alone can't run Ansible or call APIs | Components chain together with depends_on |
| Copy-pasted shell scripts per environment | --env flag + per-env state files |
| Secrets leaking into state or logs | sc.secret() — never written to disk |
| "Did that destroy actually work?" | Locks + audit log + gcloud/curl verification via HttpTest |
| Too much YAML/HCL config to maintain | Pure Python — reuse functions, loops, conditions |
Install¶
Requires Python 3.14+ and uv.
Then scaffold a project:
This writes config.py (edit it to describe your stack) and updates .gitignore.
Next steps¶
- Getting Started — from zero to your first
sc build - Concepts — how
ProjectConfig, components, refs, and state work together - CLI Reference — every command and flag
- Config Reference —
TerraformComponent,HttpTest, refs API - GCP Hello World example — a real end-to-end walkthrough