Composable pipeline labs
Development preview. These examples are on the development branch and have not shipped with the public alpha. The controller does not require this pipeline, the HTML report, Checkov, or OPA. You can bring a different workflow as long as it speaks the execution contract.
Set up once in a disposable Kind cluster
Use the Kind quickstart first to install Argo and the controller and create the lab ServiceAccount. Use a separate cluster from any workload you want to keep. These examples manage ConfigMaps, not AWS infrastructure.
From the dev/v0.1.0-alpha.3 checkout, build and load the development runner.
Use your own Kind cluster name in KIND_CLUSTER.
KIND_CLUSTER=iacstack-quickstart
docker build --platform linux/amd64 --target runner-opentofu -t iacstack-runner-opentofu:compose-dev .
kind load docker-image iacstack-runner-opentofu:compose-dev --name "$KIND_CLUSTER"
python3 -m venv /tmp/iacstack-compose-venv
/tmp/iacstack-compose-venv/bin/python -m pip install 'PyYAML==6.0.3'
/tmp/iacstack-compose-venv/bin/python examples/composable-pipeline/render.py --out /tmp/iacstack-compose
kubectl apply -f /tmp/iacstack-compose/workflows.yaml
helm upgrade iacstack-controller oci://ghcr.io/iacstack/charts/iacstack-controller \
--namespace platform-system --version 0.1.0-alpha.2 --wait \
-f website/static/examples/quickstart/controller-config.yaml \
-f /tmp/iacstack-compose/controller-values.yaml
The last values file replaces the registered workflow list in this lab cluster
only. It keeps the existing controller release and registers the five test aliases.
To use Terraform, build/load the runner-terraform target and render with
--engine terraform --runner-image iacstack-runner-terraform:compose-dev.
Use S3 for remote state
All five recipes can use the same S3 backend option. Choose it when rendering your workflow manifests. The default remains Kubernetes, so the local Kind quickstart still works without an AWS account.
For S3, use a fresh lab and a private bucket that already exists. Use a
dedicated prefix for each lab or environment; the renderer gives each stack its
own state object at <prefix>/<stack>/terraform.tfstate. The backend enables
server-side encryption and uses <key>.tflock for locking. Keep S3 Block Public
Access and versioning enabled on the bucket. The renderer does not create a bucket, copy state,
or migrate existing stacks between Kubernetes and S3. Do not repoint an existing
stack or reuse its state prefix for an unrelated deployment.
Follow the setup above, but replace the render command with this one. Substitute the bucket name, the bucket’s AWS Region, and your chosen prefix before applying the generated manifests or registering the aliases.
/tmp/iacstack-compose-venv/bin/python examples/composable-pipeline/render.py \
--out /tmp/iacstack-compose \
--backend s3 \
--s3-bucket my-private-state-bucket \
--s3-region us-east-1 \
--s3-prefix labs/composable
The examples still manage Kubernetes ConfigMaps. The AWS identity is for reading
and writing state, not for provisioning AWS resources. Associate the AWS identity
with the runner’s ServiceAccount, argo-workflows/iacstack-quickstart, for
example using EKS Pod Identity or IRSA. Scope the role to listing the bucket at
the selected prefix, reading and writing the state file, and reading, writing
and deleting its .tflock file. If the bucket uses a customer-managed KMS key, grant the required KMS access as well.
For cross-account access, the runner can use --first-role and optionally
--second-role; that path requires a runner image with AWS CLI and IAM trust
for each hop. Do not pass AWS access keys in stack inputs, manifests, or outputs.
Remote state and Argo artifacts are independent. These flags configure only where Terraform or OpenTofu stores state. They do not set up an Argo artifact repository. Review HTML and managed-approval artifacts still require storage configured separately in Argo.
Run the five recipes
Apply one of the generated manifests at a time. Watch the Argo workflow and the IaCStack status before starting the next recipe.
| Lab | File under /tmp/iacstack-compose | What to observe |
|---|---|---|
| 1. Direct | compose-direct.yaml | Validate and Plan run, then Apply creates the ConfigMap without a pause. |
| 2. Manual approval | compose-manual.yaml | Review Plan, select Approve or Reject on the Argo suspend node. Rejection does not create the ConfigMap. |
| 3. OPA | compose-opa.yaml | baseline and kind are selected in the workflow. A normal message is allowed; deny-me blocks it. |
| 4. Checkov | compose-checkov.yaml | Checkov scans the module’s HCL. The workflow applies only if the scanner passes; OPA is not called. |
| 5. Checkov + OPA | compose-combined.yaml | The scanner and policy serve different purposes. Both must permit the run to reach Apply. Try deny-me to exercise the OPA block after Checkov passes. |
kubectl apply -f /tmp/iacstack-compose/compose-direct.yaml
kubectl -n platform-system get iacstack
kubectl -n argo-workflows get workflows
kubectl -n iacstack-quickstart get configmap compose-direct \
-o jsonpath='{.data.message}'
For OPA or the combined recipe, change one input and watch a new run. The old ConfigMap value must remain unchanged when the policy denies the new plan.
kubectl -n platform-system patch iacstack compose-opa --type merge \
-p '{"spec":{"inputs":{"message":"deny-me"}}}'
For the manual recipe, approve a new run after testing rejection: patch its message to a different value, inspect the new Plan, and approve that execution. The Apply step verifies and uses the saved plan, not a new one. When done, delete the disposable cluster as in the Kind quickstart.
What each file does
These files live in examples/composable-pipeline/. Edit the stage you need without changing unrelated stages.
| File | Responsibility |
|---|---|
recipes.yaml | Defines the five stage combinations and the OPA profiles each recipe uses. |
render.py | Generates the Argo templates, controller aliases, and stack manifests. It also selects the state backend. |
scripts/validate.sh | Fetches the exact commit, prepares the module directory, and validates the HCL without opening remote state. |
scripts/plan.sh | Initializes the backend, saves the binary plan, and produces review artifacts or OPA input when enabled. |
scripts/checkov.py | Scans the module HCL and returns a pass or block result. |
scripts/opa.sh | Evaluates the plan with the selected profiles and returns a policy decision. |
scripts/route.sh | Combines Plan, Checkov, and OPA results to proceed, request approval, block, or stop with no changes. |
scripts/approval-request.sh | In managed approval mode, identifies the plan awaiting review, its deadline, and required fields. The Argo suspend step is generated separately; it is not a script. |
scripts/authorize.sh | Keeps Apply from running on a block, rejection, or empty plan. It also requests execution authorization from the controller when the recipe requires it. |
scripts/apply.sh | Checks the plan identity, claims authorization when required, applies the saved file, and verifies the result. |
scripts/helpers/execution-context.sh | Loads and validates the execution intent, commit, and target. It provides the function that identifies the plan together with that context. |
scripts/helpers/backend.sh | Prepares the module and initializes the chosen Kubernetes or S3 backend. |
scripts/helpers/auth.sh | Uses the runner identity or assumes the configured AWS roles without passing credentials as artifacts. |
policy/profiles.json and policy/*.rego | Define the optional profiles and rules that evaluate changes in the plan. |
kubectl-iacstack | Optional terminal client for fetching review evidence and submitting a decision. It does not run inside the pipeline. |
tests/verify.py | Tests the rendered manifests, script layout, and local security and authorization contract. |
How the files fit together
recipes.yaml → render.py → Argo WorkflowTemplate
validate.sh
↓
plan.sh
↓
Checkov → OPA (optional stages)
↓
route.sh
↓
human approval if required
↓
authorize.sh
↓
apply.sh if allowed
Plan saves the binary in the execution workspace and records its identity. Checkov scans code; OPA evaluates changes in the plan. If the recipe requires review, the workflow pauses before authorization. Apply checks the plan identity and uses the saved binary without generating a fresh plan to apply. Blocked, rejected, and no-change runs do not start Apply.
Add only the parts you need
- Pipeline: start from recipes.yaml. Reuse the Argo templates, copy one recipe, or swap any block. Routing and authorization glue preserve the existing execution contract.
- HTML: add
--reportto the renderer only if Argo has a private artifact repository. Plan keeps its normal log and publishesplan-reviewas an HTML artifact. For a custom pipeline, the independent command isterraform show -json tfplan | iacstack report plan --output plan.html(ortofu show). It does not send plan JSON to logs or publish it. - AWS identity: without extra roles, Plan and Apply use the identity the runner already has. An AWS variant with the AWS CLI can configure
--first-roleand optionally--second-role. Both pods authenticate independently. Do not pass session credentials as parameters or artifacts. The Kind fixture itself does not manage AWS. - OPA profiles: the workflow maintainer selects profiles; the IaCStack selects a registered alias. A profile groups Rego modules, and the engine indexes actual changes by resource type. Unrelated modules return
NotApplicable; policy errors or uncovered applicable changes stop the governed run. Shared modules are deduplicated. Error → Deny → RequireApproval → AutoApply is the decision priority. The policy bundle is immutable per generated workflow revision. - PCI and non-PCI: the sample catalog includes both as illustrative policy profiles, not compliance claims. Add a Rego module and reference it in the profile to affect only future runs of workflows using that profile. The AWS profiles are tested with plan fixtures; the runnable Kind labs use the
kindprofile. When policy is mandatory, restrict which aliases consumers may select.
Open an example HTML report . The CLI generated it from an illustrative plan; it does not provision AWS.
The saved plan and policy input stay on the per-workflow volume, not in review artifacts. Preserve access controls on both the volume and any report storage.