aios-export
aios-export — capture an Aiden OS tenant as Terraform
Read-only SE utility that snapshots a StackGen Aiden OS tenant and emits Terraform HCL plus terraform import commands. The killer use case is capturing an SE-clicked demo into a version-controlled baseline you hand to the customer or another SE.
Not the same as the Migration guide — export captures what exists in the UI; migration refactors monolithic Terraform you already maintain.
Full tool documentation: tools/aios-export/README.md
What gets exported today
| Resource kind | Exported? |
|---|---|
sg_agent |
Yes |
sg_workflow |
Yes |
sg_remote_runner |
Yes |
| Integrations, policies, secrets, schedules, webhooks | No (Phase 2 — hand-merge from modules) |
Phase 1 always produces out/tenant.tf. Phase 2 (on by default) also emits out/tenant.modules.tf with pattern-matched module blocks — diff both and commit whichever the customer prefers.
Run
cd tools/aios-export
STACKGEN_URL="https://main.dev.stackgen.com" \
STACKGEN_TOKEN="$YOUR_PAT" \
./export.sh
Optional: STACKGEN_PROJECT_ID="proj_abc123" ./export.sh
Outputs in out/:
tenant-snapshot.json— machine-readable dump (good for diffs across tenants)tenant.tf— HCL stubs for agents / workflows / remote runnersimport.sh— oneterraform importline per emitted resource
Adopt into a new root
- Create a customer directory and copy
out/tenant.tf. - Add
provider.tfwithprovider "sg"(see Prerequisites). tofu initbash out/import.shtofu plan— should show no changes once integrations and policies are hand-merged.
Related
- Adopt the repo — Path 2
- Migration guide — refactor existing Terraform, not UI capture