Skip to Content
CLI & APICommand reference

stackblaze plan

Show what apply would create or change, without making changes

Usage: stackblaze plan [options] <path>

Show what apply would create or change, without making changes

Options:
  --api-url <url>        StackBlaze API base URL (env STACKBLAZE_API_URL)
  --token <token>        API token, sb_pat_... (env STACKBLAZE_TOKEN)
  --json                 Output JSON (same as -o json) (default: false)
  -o, --output <format>  Output format: text or json (choices: "text", "json")
  -h, --help             Print help

May be disabled by your platform admin.

Example

Preview what a folder of manifests would change before you apply it. infra/shop-api.app.yaml declares one new app:

apiVersion: stackblaze.com/v1
kind: StackBlazeApp
metadata:
  name: shop-api
  pipeline: github-demo-cw8z
  phase: dev
spec:
  deploymentstrategy: docker
  image:
    repository: nginxinc/nginx-unprivileged
    tag: "1.27"
    containerPort: 8080
  resources:
    requests:
      cpu: 100m
      memory: 128Mi
    limits:
      cpu: 500m
      memory: 256Mi
  web:
    replicaCount: 1
stackblaze plan infra/
create app github-demo-cw8z/dev/shop-api

Plan: 1 to create, 0 to update

With --json, e.g. to fail a CI job when anything would change:

stackblaze plan infra/ --json
{
  "create": 1,
  "update": 0,
  "unchanged": 0,
  "resources": [
    {
      "kind": "StackBlazeApp",
      "name": "shop-api",
      "pipeline": "github-demo-cw8z",
      "phase": "dev",
      "action": "create"
    }
  ]
}

While the project's Infrastructure as Code switch is off, plan is refused (exit 3):

stackblaze plan infra/
x  plan failed for app github-demo-cw8z/dev/shop-api: Infrastructure as Code is not enabled for project "github-demo-cw8z". Enable it under Project Settings → General → Infrastructure as Code. Or from the CLI: stackblaze projects iac on -p github-demo-cw8z

On this page