Execution CLI reference

Commands, Argo output transport, result semantics and authorization.

The iacstack CLI runs inside workflow Pods. It is the reference client of the execution contract, not a replacement for kubectl, Terraform, OpenTofu or your pipeline. Use the binary included in the release runner or copy it into your own image.

1. Receive the intent

Declare the workflow argument intent in the WorkflowTemplate and pass it to each relevant script or container as environment variables:

env:
  - name: INTENT
    value: "{{workflow.parameters.intent}}"
  - name: WORKFLOW
    value: "{{workflow.name}}"

The CLI validates the envelope, including the workflow/intent identity. WORKFLOW confirms the transport identity when set. Use iacstack --intent-file /path/intent.json --output-dir /path/outputs COMMAND to override the input and output directory; global flags precede the command. By default it reads INTENT and writes private atomic files under /tmp. The workflow is responsible for target validation and resolving the effective source, including honoring a supplied pinned reference and existing binding.

2. Command reference

CommandOutput / effect
intent readValidated JSON envelope on stdout
intent get PATHValue relative to intent; strings as text, other values as JSON
resolve --reference REV --binding BINDINGresolved-source
progress --phase Running|Waiting [--drift-detected]execution-state
authorization request --token TOKENauthorization-request
authorization claim --token TOKEN [--timeout 30s]Atomic claim in IaCStack status through Kubernetes API
result --outcome Verified|NoChanges|Blocked|Cancelledexecution-result

These commands illustrate the protocol; place them in the appropriate steps of your pipeline rather than reporting success unconditionally:

iacstack intent read > /tmp/intent.json
iacstack intent get sourceRef.repository
iacstack intent get operation
# REV and BINDING are resolved and validated by your workflow.
iacstack resolve --reference "$REV" --binding "$BINDING"
iacstack progress --phase Running
# When observed:
iacstack progress --phase Waiting --drift-detected
# After a no-change apply plan:
iacstack result --outcome NoChanges
# OR after applying and verifying a change:
# iacstack result --outcome Verified

Progress and result accept --reason CODE, --message TEXT, and repeated --detail KEY=VALUE. Keep diagnostics short and non-sensitive. Do not log the full intent or copy plans, credentials or state into outputs. Envelopes are limited to 4 KiB.

3. Publish outputs to Argo

Creating a file in a Pod is not sufficient: the template must expose it with a matching global parameter. The direct workflow declares the following outputs at the template level (sibling of script):

outputs:
  parameters:
    - name: resolved-source
      globalName: resolved-source
      valueFrom:
        path: /tmp/resolved-source
        default: ""
    - name: execution-result
      globalName: execution-result
      valueFrom:
        path: /tmp/execution-result
        default: ""

Configure the same names under the alias in Helm values. For progress and authorization, map /tmp/execution-state and /tmp/authorization-request similarly in the steps producing them. Optional signals must not become required inputs in an integration that omits them. Outputs are observed when Argo publishes them; writing a file alone does not notify the controller immediately.

4. Authorization-enabled workflow

Human or policy approval decides whether a change is acceptable. The controller grant verifies current execution identity and intent. They are distinct.

The alias must use this contract mapping:

contract:
  authorization: true
parameters:
  input:
    intent: intent
  output:
    resolvedSource: resolved-source
    state: execution-state
    authorization: authorization-request
    result: execution-result

After source resolution, plan and policy/approval, derive a token from the exact reviewed plan and execution context (including backend binding), then run in a dedicated request step:

iacstack authorization request --token "$TOKEN"

Publish its output:

outputs:
  parameters:
    - name: authorization-request
      globalName: authorization-request
      valueFrom:
        path: /tmp/authorization-request

Complete the request step so Argo can expose the request. In a later mutation step, retrieve and verify the identical saved plan, effective revision, target binding and token. Only then run:

set -euo pipefail
iacstack authorization claim --token "$TOKEN" --timeout 30s
# Only after successful claim, execute the verified saved plan.
# Verify the actual outcome before publishing Verified.

The mutation Pod must be authorized to read the target IaCStack and patch its status. Restrict those permissions to the workflow identity and intended namespace, with admission controls for claim-only writes where available. Do not grant arbitrary status writes to untrusted workloads. The Argo task-result permissions and infrastructure/state permissions are separate.

The claim uses Kubernetes API credentials and an atomic resourceVersion check. Timeout defaults to 30s and must be positive, at most five minutes. Exit codes:

CodeMeaning
0Success; claim write confirmed by API
2Invalid command, intent or envelope
3Claim rejected by current intent
4Claim timeout
5Operational failure or ambiguous write

Never apply when claim exits nonzero. A claim is not a human approval or an infrastructure lock. For contract.authorization: false, omit both authorization commands and the authorization output mapping; the controller cannot atomically identify the start of apply and waits for the active attempt to finish.

5. Choose the terminal result

OutcomeWhen to use
NoChangesApply plan confirms no change; no mutation is required
VerifiedApplied and verified change, or verified destroy; claim required when authorization is enabled
BlockedFunctional refusal, including invalid target or policy rejection before mutation
CancelledDeliberate cancellation without starting mutation

NoChanges and Verified require native Argo Succeeded. A native failure without a functional result is an operational failure; native success without a valid result blocks reconciliation. Publish source resolution before progress, authorization or success. A Blocked result may be published before resolution for input rejection. For destruction, use Verified after verifying absence, not NoChanges.

The workflow owns Git, backend identity and locking, policy, credentials, plan integrity, apply and verification. The controller owns scheduling, attempt exclusivity, reconciliation and contract state.

Full transport specification · CLI implementation guide · Create a workflow · Adopt an existing pipeline