Create your own workflow
An IaCStack chooses a workflow alias. The alias points to an Argo WorkflowTemplate, and Argo starts a runner pod to execute it. See How it works for the full path.
1. Clone a working WorkflowTemplate
After the Kind quickstart, stay in the same quickstart directory and shell. With jq installed, create a separate copy using the same published runner:
kubectl -n argo-workflows get workflowtemplate iacstack-quickstart-direct -o json |
jq '{apiVersion, kind, metadata: {name: "my-direct", namespace: .metadata.namespace}, spec}' |
kubectl create --dry-run=client -f - -o yaml > my-workflow.yaml
kubectl apply --dry-run=server -f my-workflow.yaml && kubectl apply -f my-workflow.yaml
Open my-workflow.yaml. This excerpt shows which fields connect the pieces. It is not a replacement for the complete clone.
apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
name: my-direct
namespace: argo-workflows
spec:
entrypoint: direct
serviceAccountName: iacstack-quickstart
arguments:
parameters:
- name: intent
templates:
- name: direct
volumes:
- name: lab-scripts
configMap:
name: iacstack-lab-direct-script
container:
image: ghcr.io/iacstack/iacstack-runner-opentofu:v0.1.0-alpha.2
command: [bash]
args: ["/lab/scripts/validate-plan-apply.sh"]
env:
- {name: INTENT, value: "{{workflow.parameters.intent}}"}
- {name: WORKFLOW, value: "{{workflow.name}}"}
- {name: IAC_ENGINE, value: tofu}
volumeMounts:
- {name: lab-scripts, mountPath: /lab/scripts, readOnly: true}
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: ""}
Your choices: template and step names, order, runner image and commands. Keep the contract: accept the mapped intent parameter. The runner uses iacstack intent read, then publishes the mapped resolved-source and execution-result outputs. If you rename those parameters, change both the workflow and its alias mapping. See the execution contract before enabling authorization or replacing the runner implementation.
2. Register the alias
Run helm get values iacstack-controller -n platform-system -o yaml > custom-values.yaml. Append the item below to the existing workflows list; keep the other aliases. Apply when no workflow attempts are active.
- name: my-direct
namespace: argo-workflows
templateRef: {name: my-direct}
serviceAccountName: iacstack-quickstart
contract: {authorization: false}
parameters:
input: {intent: intent}
output: {resolvedSource: resolved-source, result: execution-result}
helm upgrade iacstack-controller "$CHART" --version "$CHART_VERSION" \
-n platform-system -f custom-values.yaml --wait
Authorization is disabled only for this isolated, direct-apply example. Keep the ServiceAccount scoped to the lab.
3. Use the alias from an IaCStack
Save the following as custom-stack.yaml for a separate ConfigMap and state. In the manifest, spec.workflowRef.name selects my-direct, sourceRef still identifies the IaC module, and spec.inputs.message carries the new value.
apiVersion: iacstack.io/v1alpha1
kind: IaCStack
metadata:
name: custom-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: my-direct
inputs:
message: Hello from custom workflow
lifecycle:
deletionPolicy: Retain
kubectl apply -f custom-stack.yaml
kubectl -n platform-system get iacstack custom-stack -w
After reconciliation, confirm the ConfigMap: kubectl -n iacstack-quickstart get configmap custom-stack -o jsonpath='{.data.message}'. Expect Hello from custom workflow. Keep my-workflow.yaml if you want to try your own runner next.