How it works

Set up the controller and workflow, then follow an IaCStack from intent to result.

An IaCStack is a Kubernetes API resource that describes infrastructure intent. The controller watches the declaration, determines when an execution can start, and tracks its result. Argo Workflows runs the selected pipeline.

From the stack request to the result
  1. IaCStack

    Declares what to run, the inputs, and the workflow alias.

    spec:
      workflowRef:
        name: manual-aws-sg
      inputs:
        vpc_id: vpc-…
  2. IaC Stack Controller

    Watches the stack, looks up its alias, and creates a Workflow from the registered template.

    alias → WorkflowTemplate
  3. Argo Workflows

    Runs the recipe. Your WorkflowTemplate defines the stages, commands, pauses, and outputs.

    steps scripts outputs
  4. Runner pod

    Uses the image and ServiceAccount chosen for the workflow to run the tools and report outputs.

    Terraform / OpenTofu iacstack CLI
The result returns to IaCStack.status

Argo exposes the runner’s outputs. The controller watches the Workflow and updates the stack’s status.

Example with manual approval and technical authorization
  1. Plan
  2. Review and approve in Argo
  3. Controller authorizes the current attempt
  4. Apply

Reject ends the run without Apply.

From intent to EC2 in 38 seconds

Watch the demo on the homepage . The video player and GIF are in the same section.

A WorkflowTemplate is the reusable recipe. A Workflow is one run of that recipe in Argo. The pipeline is the recipe’s sequence of stages and the scripts and tools you choose. Add security checks, use your own runner image, or run without a pause.

Before the first run

This is the setup order used by the Kind quickstart. You can prepare the runner and its template earlier. The prerequisite is that the controller, alias, template, and runner identity are all in place before you apply the first stack.

  1. Have Kubernetes and Argo Workflows running. Argo must watch the namespace that will receive the Workflows. In the lab it is argo-workflows. GitOps delivery is optional; there is no Argo CD or cloud prerequisite for this lab.

  2. Install IaC Stack Controller and register the alias. Its Helm chart installs the controller, the IaCStack CRD and its permissions. In the values, a workflow registration ties an alias to an Argo namespace, template, runner identity, and parameter mapping. Here is the registration from the direct lab:

    workflows:
      - name: direct
        namespace: argo-workflows
        templateRef:
          name: iacstack-quickstart-direct
        serviceAccountName: iacstack-quickstart
        contract:
          authorization: false
        parameters:
          input:
            intent: intent
          output:
            resolvedSource: resolved-source
            result: execution-result
    

    The alias direct is what the stack selects. The output mapping tells the controller which global Argo parameters contain the resolved source and the functional result. This isolated example has no technical authorization or human approval. One installation can register multiple aliases in the same workflows list. For example, one stack selects direct in spec.workflowRef.name and another selects governed. Each alias can have its own template, ServiceAccount, and contract. If a stack omits the alias, the controller uses the configured defaultWorkflow. See the three aliases in the EKS labs.

  3. Apply the workflow bundle. It contains the runner’s Kubernetes ServiceAccount and its permissions, the script ConfigMap and the WorkflowTemplate. The ServiceAccount lets the pod report task results and access the target and state backend. The template defines an entrypoint, accepts the JSON intent, sets the runner image and calls the mounted validate-plan-apply.sh. It exposes the files the runner writes as the two mapped outputs. Put your own scripts and tools here, not in the controller.

See the complete WorkflowTemplate and alias example · Run the lab step by step

1. Declare the stack

This is the manifest used in Get started. It creates a ConfigMap with a small OpenTofu module.

apiVersion: iacstack.io/v1alpha1
kind: IaCStack
metadata:
  name: hello-stack
  namespace: platform-system
spec:
  sourceRef:
    repository: https://github.com/iacstack/iac-stack-controller.git
    path: website/static/examples/quickstart/module
    version: main
  workflowRef:
    name: direct
  inputs:
    message: Hello from IaCStack
  lifecycle:
    deletionPolicy: Retain

  • sourceRef identifies the module and revision. In this lab, the workflow resolves main to a specific commit before execution.
  • workflowRef.name selects an alias registered by the operator. Here, direct points to the direct-apply WorkflowTemplate.
  • inputs supplies the values the workflow passes to the module. In this case, message becomes the ConfigMap content.
  • lifecycle.deletionPolicy determines what happens when deleting the stack. Retain preserves the managed resource. Destroy requests a teardown execution.

The same manifest can be applied with kubectl or delivered through GitOps. API reference

2. From declaration to workflow

  1. The controller sees the stack. It checks whether the stack is eligible, including the alias, dependencies and suspension. It creates an attempt and submits a Workflow in Argo from the registered template, with the stack’s operation, source, inputs and attempt identity in intent.
  2. Argo creates the pod. It runs the configured image and script as the runner’s ServiceAccount. In the direct lab, the script uses iacstack intent read to validate and read the intent, resolves the module to a commit, and runs OpenTofu validate, plan and apply when there is a change.
  3. The result comes back through Argo. The runner uses the Go CLI iacstack to write the contract files. Argo publishes them as resolved-source and execution-result; the controller watches the Workflow and updates the stack’s status. The CLI is a ready-made way to speak the contract; you can use a different runner or implement the same contract yourself.
  4. Optional gates live in the workflow. A manual flow saves the plan and waits for a person to accept or reject it. OPA can add a policy decision. If technical authorization is enabled, the workflow requests an authorization for the current attempt and claims it before apply. The reviewer approves the change; the controller authorizes the attempt. A rejected plan never reaches apply.

Execution contract · CLI reference · Argo integration

3. Follow the result

Start with the Kubernetes status. The status.execution.workflow field identifies the execution in Argo.

kubectl -n platform-system describe iacstack hello-stack
kubectl -n platform-system get iacstack hello-stack -o jsonpath='{.status.execution.workflow}'
kubectl -n argo-workflows get workflow -l iacstack.io/stack-name=hello-stack

A Ready result indicates a completed execution for that intent. Its reason distinguishes Verified, when the workflow applied and verified a change, from NoChanges, when the plan confirmed the existing state. For native manual approval, open the corresponding node in Argo to review the plan. If an attempt fails or is blocked, compare the stack condition with the workflow result and logs.

4. Reconcile after the first execution

In the lab, changing spec.inputs.message starts a new attempt and updates the ConfigMap. In a governed environment, a stack can also depend on another stack, schedule drift checks, and choose its deletion policy. For example, with a registered governed alias:

spec:
  workflowRef:
    name: governed
  dependsOn:
    - name: network
  reconciliation:
    driftCheckInterval: 24h
  lifecycle:
    deletionPolicy: Retain

This snippet is part of a stack. The workflow implements the check and reports the result to the controller. The interval schedules the attempt. The workflow policy determines whether detected drift needs review or can be corrected automatically. Try drift without AWS in the Kind labs. To see governance for AWS resources, follow the OPA lab on EKS.

Architecture and responsibilities · Operations


Argo Workflows

Configure the workflow that plans, reviews, and applies stack changes.