@neutronappsio/cirrus
v1.1.0
Published
Terraform form generator to bridge the gap between user requests and IaC!
Readme
🧩 Cirrus JSON Schema Documentation for Dynamic Form Configuration
This schema format defines a way to dynamically describe form fields, validations, conditions, and nested list structures. It's designed for form-driven workflows for configuring infrastructure-as-code, specifically using Terraform.
📋 Schema Structure Overview
Each schema is an array of field definitions. Each field object describes:
- Field type and UI metadata
- Validation rules
- Conditional logic
- Default values
- Nested list inputs
🔑 Common Field Properties
| Property | Type | Required | Description |
| ------------- | ---------- | -------- | --------------------------------------------------------------------------------------------------------------------- |
| id | string | ✅ | Unique identifier used for data access and conditional logic. |
| type | string | ✅ | One of: text, option, multi, list. |
| label | string | ✅ | Label shown to the user. |
| description | string | ✅ | Helper text shown in the UI. |
| default | any | ❌ | Default value (varies by type). |
| validation | string[] | ❌ | Validation rules. See Laravel Validation Docs. |
| condition | string | ❌ | Conditional visibility expression using JEXL. |
| inCode | boolean | ❌ | If false, excludes field from generated code. Default is true. |
🧱 Field Types
🔤 text
Simple string input.
{
"id": "akv_name",
"type": "text",
"label": "Name",
"description": "The name of your Azure Key Vault",
"default": "akv",
"validation": ["required", "max:5"]
}🎛️ option
Single-choice dropdown.
{
"id": "akv_location",
"type": "option",
"label": "Location",
"description": "Where to deploy",
"options": [
{ "label": "East US", "value": "EastUS" },
{ "label": "West US", "value": "WestUS" }
],
"default": { "label": "East US", "value": "EastUS" },
"validation": ["required", "in:EastUS,WestUS"]
}✅ multi
Multi-select using checkboxes or tags.
{
"id": "akv_zones",
"type": "multi",
"label": "Zones",
"description": "Availability zones",
"options": [
{ "label": "One", "value": 1 },
{ "label": "Two", "value": 2 },
{ "label": "Three", "value": 3 },
{ "label": "Four", "value": 4 }
],
"default": [1, 2],
"validation": ["required", "array", "list", "min:1", "max:3", "distinct"]
}📄 list
A repeatable array of field groups (e.g., multiple storage accounts).
{
"id": "sa_list",
"type": "list",
"label": "Storage Accounts",
"description": "Configure multiple storage accounts",
"fields": [
{
"id": "sa_location",
"type": "option",
"label": "Location",
"description": "Deployment region",
"options": [
{ "label": "East US", "value": "EastUS" },
{ "label": "West US", "value": "WestUS" }
],
"default": { "label": "East US", "value": "EastUS" },
"validation": ["required", "in:EastUS,WestUS"]
},
{
"id": "sa_nickname",
"type": "text",
"label": "Nickname",
"description": "Name to reference this account",
"default": "acct",
"validation": ["required", "max:5", "distinct"],
"condition": "list.sa_location == 'WestUS' && includes(list.sa_zones, 1)"
},
{
"id": "sa_zones",
"type": "multi",
"label": "Zones",
"description": "Availability zones for this account",
"options": [
{ "label": "One", "value": 1 },
{ "label": "Two", "value": 2 },
{ "label": "Three", "value": 3 },
{ "label": "Four", "value": 4 }
],
"default": [1, 2],
"validation": ["required", "array", "list", "min:1", "max:3", "distinct"]
}
],
"default": [
{
"sa_location": "WestUS",
"sa_nickname": "stor",
"sa_zones": [1]
},
{
"sa_location": "EastUS",
"sa_nickname": "hello",
"sa_zones": [1]
}
],
"validation": ["required", "array", "min:2", "max:5"]
}✅ Validation Rules
Validation rules follow the Laravel validation syntax.
Common examples:
| Rule | Description |
| ---------- | ----------------------------------- |
| required | Field must have a value |
| max:N | Maximum length (text) or array size |
| min:N | Minimum length (text) or array size |
| distinct | Values must be unique |
| array | Must be an array |
| list | Required for multi/list types |
| in:A,B,C | Must match one of the listed values |
⚙️ Conditional Logic
The condition field uses JEXL expressions to control dynamic visibility.
Syntax Examples
Show if "Three" is selected in zones:
includes(form.akv_zones, 3)Inside a
list, show field only when location is WestUS and zone 1 is selected:list.sa_location == 'WestUS' && includes(list.sa_zones, 1)
Context
| Scope | Prefix |
| ----------- | ------- |
| Root-level | form. |
| Inside list | list. |
🔧 inCode Flag
If present and set to false, the field is excluded from generated outputs like Terraform or ARM templates.
"inCode": falseUseful for UI-only helper fields or configuration metadata.
🧰 Example Summary
Root-Level Example (AKV)
{
"id": "akv_name",
"type": "text",
"label": "Name",
"description": "Key Vault name",
"default": "akv",
"validation": ["required", "max:5"],
"condition": "includes(form.akv_zones, 3)"
}Nested List Example (SA)
{
"id": "sa_list",
"type": "list",
"fields": [
{
"id": "sa_location",
"type": "option",
...
},
{
"id": "sa_nickname",
"type": "text",
"condition": "list.sa_location == 'WestUS' && includes(list.sa_zones, 1)"
},
{
"id": "sa_zones",
"type": "multi",
...
}
]
}