Input Management
Defining Configuration Data with JSON
While assets (CSVs) define the ground-truth infrastructure components and always create resources in the graph, Inputs (data/input/*.json) provide structural, environmental, or module-specific configuration data. Inputs never create resources. Instead, they are strictly used to look up data, which is exposed as variables in your templates.
When using modules, the module.toml manifest can declare the exact schemas it expects for these input files. rescile validates the user’s data against this schema, ensuring the module receives data in the expected format.
Defining Inputs ([input])
Describes an input file (e.g., a JSON configuration) that the module expects in the user’s data/input directory.
[input."config.json"]
description = "Environment-specific configuration."
format = "object_of_objects"
[inputs."config.json".fields]
replicas = { type = "integer", required = true }
cpu = "string"
Validations for [input] block:
| Key | Description |
|---|---|
format |
Defines the expected structure of the JSON file. Currently supported: object_of_objects (a top-level object containing other objects). |
fields |
An array of tables defining the schema for the inner objects. Used in conjunction with format. |
Validations for a fields table:
| Key | Description |
|---|---|
name |
Required. The name of the field (JSON key). |
required |
Optional. A boolean (true or false) indicating if the field must be present. Defaults to false. |
type |
Optional. The expected data type. Supported: string, integer, number, boolean, array_of_string, array_of_integer, object. Defaults to string. |
allow_empty |
Optional. A boolean (true or false) indicating if a string or array can be empty. Defaults to true. |
allowed_values |
Optional. An array of strings that the field’s value must match (for string types). |
Graph Requirements ([[requirement]])
Checks if specific resources and properties exist in the overall graph, validating that a module’s assumptions about the environment hold true.
[requirements.k8s_cluster]
properties = ["version", "region"]
description = "The module expects Kubernetes clusters with version and region info."
Generating Inputs Automatically
Instead of requiring users to manually craft JSON inputs, a module can actively fetch or scaffold them using Data Generators. By defining a [generators.<name>] block in module.toml and setting the target_input field, rescile will execute a specified script or command to generate the input data before processing.
For detailed information on configuring commands, caching (TTL), and security, see the Data Generators documentation.