Asset Management
Defining the Ground Truth of Your Infrastructure with CSVs
The rescile Asset Engine is the foundation of your infrastructure model. It builds the initial resource graph from a set of “ground truth” data sources. These sources are simple, human-readable CSV files known as Assets, located in the data/assets/ directory. Each asset file represents a collection of a single type of component in your environment, such as applications, databases, networks, or contracts.
Assets are the artifacts that are taken as given and do not need to be modeled. Ideally, they are provided by an external system of record (like a CMDB, a contract management system, or a cloud provider’s inventory export). This “configuration-as-code” approach allows subject matter experts to easily provide and maintain foundational data without needing to understand complex graph structures.
Important: Every row in an asset file always creates a resource in the graph. If no relationship is established to these resources during the modeling or compliance phases, they will remain as orphaned resources in the final graph. By contrast, Inputs are strictly used to look up configuration data and do not create resources themselves.
Core Conventions
The rescile asset engine follows several key conventions to transform flat CSV files into graph resources.
File Naming Determines Resource Type
The name of the CSV file (without the extension) determines the type (or label) for all resources created from it.
data/assets/application.csv→ creates resources of typeapplication.data/assets/database.csv→ creates resources of typedatabase.
The First Column is the Primary Key
Every CSV file must have a header row. The first column is always treated as the unique primary key for the resources in that file. rescile automatically creates an additional name property for every resource, populated with the value from this first column, to ensure a consistent primary key property across all resource types.
data/assets/application.csv
name,owner,runtime
billing-api,team-alpha,java
frontend-app,team-bravo,nodejs
- The header of the first column is
name. billing-apiandfrontend-appare the unique primary key values.- While the header for this column can be anything (e.g.,
id, or matching the file name likeapplication),rescilewill always create anameproperty from its value for consistency.
Subsequent Columns are Properties
All columns after the first one become the properties of the resource. The column header is the property’s key, and the cell value is its value.
The billing-api resource will have the properties:
name: “billing-api” (from the primary key column)owner: “team-alpha”runtime: “java”
Automatic Type Conversion
All values are initially read as strings, but the importer automatically converts them to appropriate types based on their content:
"true"/"false"(case-insensitive) → Booleans (true/false)"123"→ Integers (123)"123.45"→ Floats (123.45)"item1, item2"→ Array of strings (["item1", "item2"])
To prevent automatic conversion and enforce that a column’s values are always treated as strings, prefix the column header in your CSV file with a tilde (~). This is useful for values that might otherwise be misinterpreted, such as version numbers that look like floats (e.g., "2.0") or names that contain commas.
Example: Enforcing String Type
Consider a CSV for legal entities where a name might contain a comma:
data/assets/party.csv
name,~legal_name
cloudflare,"Cloudflare, Inc."
- Without the
~prefix onlegal_name, the value"Cloudflare, Inc."would be incorrectly parsed as an array:["Cloudflare", " Inc."] - With the
~legal_nameheader, the importer correctly treats the entire value as a single string property:legal_name: "Cloudflare, Inc."
Creating Relationships
The asset engine can implicitly create relationships between resources using two powerful, convention-based methods. This automatic linking is a convenience that works well for simple foreign-key style connections.
Method 1: Foreign Keys (Implicit Linking by Column Name)
If a column header in one CSV file matches the filename of another (e.g., a database column in application.csv), the importer automatically creates a relationship.
-
Define
database.csv:name,type,version billing-db,PostgreSQL,14 -
Add a
databasecolumn toapplication.csv:name,owner,database billing-api,team-alpha,billing-db
- Result: A relationship is created from the
billing-apiapplication to thebilling-dbdatabase. The relationship’s type is taken from the column name,database.(application:billing-api) -[database]-> (database:billing-db)
Method 2: Multiple Relationships from a Single Column (Implicit 1-to-N Linking)
If a foreign key column contains a comma-separated list of values, rescile will create a separate relationship for each value.
data/assets/application.csv
name,owner,dependencies
billing-api,team-alpha,"auth-service,logging-service"
- Result: If
auth-serviceandlogging-serviceexist as primary keys in adependencies.csvfile, thebilling-apiapplication will have two outgoing relationships of typedependencies.
Advanced Features
Ignoring Columns for Relationship Creation
If a column name matches another resource type but you do not want a relationship to be created, prefix the column header with an underscore (_). The column will be imported as a regular property, and no relationship will be created.
name,_database
billing-api,"This is just a comment about a database"
Renaming Relationship Types
The default relationship type is the column name. You can override this using a [[retype_relation]] rule in a Model file.
data/models/application.toml
origin_resource = "application"
[[retype_relation]]
property_key = "database" # The column name in the CSV
new_type = "CONNECTS_TO" # The new relationship type
- Result: The relationship will now be
(application) -[CONNECTS_TO]-> (database).
This foundational graph is then ready to be transformed and enriched by the architectural Models and governed by Compliance Rules.
Module Asset Configurations (module.toml)
When using reusable modules, the module’s module.toml manifest can define schemas and transformations for your asset files. This allows a module to actively influence the asset’s properties and identity.
[assets."application.csv"]
resource_type = "application" # Optional: Explicitly map the file to a resource type
name_template = "app-{{ name | lower }}" # Optional: Generates a new primary key dynamically
description = "The main asset file defining the applications."
[assets."application.csv".columns]
name = { type = "string", required = true, description = "name of the application" }
owner = { type = "string", required = true }
Key Capabilities:
name_template: Modules can dynamically alter the primary key (thenameproperty) of an asset. Using a Tera template, you can combine columns or format strings (e.g.,"{{ environment }}-{{ name }}") to guarantee uniqueness or conform to a module’s naming convention.resource_type: Overrides the default behavior of using the filename as the resource type.- Validation: Ensures required columns are present and data matches the expected type.
Validations for columns table:
| Key | Description |
|---|---|
name |
Required. The name of the column (CSV header). |
required |
Optional. A boolean (true or false) indicating if the column must be present in the CSV file. Defaults to false. |
type |
Optional. The expected data type of the values in the column. Supported: string, integer, number, boolean, array_of_integer, array_of_string. Defaults to string. |
allow_empty |
Optional. A boolean (true or false) indicating if a cell in this column can be empty. Defaults to true. |
description |
Optional. A human-readable description of the column’s purpose. |
Generating Assets Automatically
Instead of manually creating CSV files, a module can automatically generate them using Data Generators. By defining a [generators.<name>] block in module.toml and setting the target_asset field, rescile will execute a specified script or command to fetch or scaffold the asset data before the graph is built.
For detailed information on configuring commands, caching (TTL), and security, see the Data Generators documentation.