Command-line engine for Grid: turn grid.json into Terraform/OpenTofu using the
grid-terraform module bank, then optionally apply.
grid-core calls this CLI on deploy (grid generate). You can also run it alone.
Not vendored in this repo. Modules are copied at generate time from sibling
../grid-terraform (or GRID_MODULE_BANK). The templates/terraform/ folder
is intentionally empty of modules — see templates/terraform/README.md.
- Validate
grid.json(open schema: any catalog type + passthrough fields). - Look up each resource
typein the CLI resource catalog →modulePath. - Copy that folder from the module bank into
generated/modules/. - Emit a
moduleblock; request fields become Terraform variables.
Convenience only on AWS/GCP: vpc / subnet / vm still use dedicated
composers that wire a small network graph. Every other type (and every type on
other clouds) uses the catalog path.
| Path | Feature flags | What you need |
|---|---|---|
| Console (UI) | Yes — hides / does not send off types | Flag true in grid-ui featureFlags.ts |
| HTTP API (grid-core) | No | Correct POST /deployments body + working CLI/bank/creds |
| CLI | No | Valid grid.json + module in grid-terraform + cloud/provider creds |
Someone who knows the API body can deploy a type the console hides. That is intentional.
cd grid-cli
npm install
npm run build
# Sibling module bank required (or set GRID_MODULE_BANK)
grid generate --config examples/simple-vpc-vm.json --output ./generated --format terraform
grid validate --config examples/aws-s3-bucket.jsonSample desired-state: grid-config. Step-by-step AWS/GCP plan & deploy: grid-docs → CLI. Admin / environments / approvals: grid-docs → Admin RBAC. Self-host install: grid-docs → Install.
{
"provider": "aws",
"project": "demo",
"region": "ap-south-1",
"resources": [
{
"type": "s3",
"name": "logs",
"bucket": "my-unique-grid-logs-bucket"
}
]
}type must exist in the catalog for that provider. Extra keys must match the
module’s variables.tf in grid-terraform.
| Command | Purpose |
|---|---|
grid generate |
JSON → Terraform/OpenTofu under --output |
grid plan |
generate + terraform plan (preview create/change/destroy) |
grid deploy |
generate + init/plan/apply (converge); updates local inventory when under a config root |
grid deploy --config-dir … --reconcile |
apply added + changed units only (never destroys stale) |
grid destroy |
terraform destroy for a workspace (+ inventory cleanup) |
grid validate |
schema check |
grid status |
inspect a generated workspace |
grid status --config-dir … |
diff desired JSON vs inventory: added / changed / unchanged / stale |
grid prune --config-dir … |
list stale units (JSON deleted); suggest destroy |
grid prune --config-dir … --destroy |
confirm, then destroy selected stale workspaces |
grid providers |
list registered cloud adapters |
grid-config (or any tree of *.json Grid configs) is the source of truth.
# See what changed / what is stale
grid status --config-dir ../grid-config
# Apply new/edited JSON only
grid deploy --config-dir ../grid-config --reconcile
# JSON deleted → listed as stale; destroy only after confirmation
grid prune --config-dir ../grid-config
grid prune --config-dir ../grid-config --destroyInventory + workspaces live under <config-dir>/.grid/ (gitignored automatically).
| Variable | Purpose |
|---|---|
GRID_MODULE_BANK |
Absolute path to grid-terraform (optional) |
GRID_CONFIG_ROOT |
Default desired-state root for --config-dir resolution |
MIT — see LICENSE.