Infrastructure as Code
Export projects and apps as manifests, preview changes, apply them, and tear them down.
Infrastructure as Code is opt-in and off by default for each project. Check with stackblaze status; export, plan, apply and destroy refuse when it is off.
The manifests are YAML documents in the format stackblaze export writes, one per project and one per app. App documents need metadata.pipeline and metadata.phase. A path can be a file or a directory (all .yaml and .yml files, recursively). This is separate from the stackblaze.yaml blueprint file.
stackblaze status
Checks that the API is reachable with your credentials and reports whether Infrastructure as Code is enabled. Pass --pipeline (or run in a linked directory) to check one project. With an app in scope it also shows that app's state, for example paused. Exits 0 whether IaC is on or off.
stackblaze statusAlso accepts the scope flags (-p, --pipeline, --phase, -a, --app) and the output flags (-o, --output, --json), plus --token and --api-url. Common flags
Examples
stackblaze status -p shopstackblaze export
Writes one YAML file per project and per app that plan and apply accept. Exported app files include variable values, so review them before committing.
stackblaze export [--out <dir>] [-p <project>]| Flag | Description |
|---|---|
--out <dir> | Output directory (default stackblaze) |
-p, --pipeline <name> | Export one project (default: all you can see) |
Also accepts the output flags (-o, --output, --json), plus --token and --api-url. Common flags
Examples
stackblaze export --out ./infra -p shopstackblaze plan
Compares the manifests with what is live and prints what apply would create or update, with a diff for updates. Nothing is changed.
stackblaze plan <path>Also accepts the output flags (-o, --output, --json), plus --token and --api-url. Common flags
Examples
stackblaze plan ./stackblazestackblaze apply
Creates or updates every project and app declared in the manifests, projects first. It never deletes. Exits 1 if any resource failed.
stackblaze apply <path> [--continue-on-error]| Flag | Description |
|---|---|
--continue-on-error | Keep going after a resource fails (default: stop at the first failure) |
Also accepts the output flags (-o, --output, --json), plus --token and --api-url. Common flags
Examples
stackblaze plan ./stackblaze && stackblaze apply ./stackblazestackblaze destroy
Deletes every resource declared in the manifests, apps first, then projects. Lists what will be deleted and asks you to type yes unless -y. Exits 1 if any deletion failed.
stackblaze destroy <path> [-y]| Flag | Description |
|---|---|
-y, --yes | Do not prompt |
Also accepts the output flags (-o, --output, --json), plus --token and --api-url. Common flags
Examples
stackblaze destroy ./stackblaze -y