Convention-Based Creation (create_from)
Generating Resources from Property Values and Data Lists
The create_from directive inside a [[create_resource]] block provides two powerful convention-over-configuration
patterns for resource creation.
create_from = { property = "..." }— creates resources from the values of a property on theorigin_resourcecreate_from = { list = "..." }— creates resources by iterating over an abstract data list defined in the header
Both patterns make the iterated item available as {{ value }} inside templates.
Pattern 1: Creating from a Property Value
When a property contains a list (an array or a comma-separated string), create_from creates one resource for
each item. The property name becomes the default resource type, and the property value becomes the default
primary key (name). Both can be overridden.
data/assets/application.csv
name,service
zabbix,"monitoring, alerting"
data/models/application_services.toml
origin_resource = "application"
[[create_resource]]
create_from = { property = "service" }
relation_type = "PROVIDES"
name = "svc-{{ value | upper }}"
[create_resource.properties]
category = "Operations"
Result: Two service resources are created — svc-MONITORING and svc-ALERTING — each linked to the
zabbix application via a PROVIDES relationship.
Type Resolution Priority
The resource type for items created by create_from is resolved in this order (highest priority first):
- The
askey inside thecreate_fromblock:create_from = { property = "service", as = "platform_service" } - The top-level
resource_typedirective - The property name itself (e.g.,
"service")
Deriving from a Related Node (property_origin and relation_origin)
Use property_origin to read the source property from a related node instead of the origin_resource. Use
relation_origin to control where the new relationship starts from.
Goal: From a subscription, find its related application, read its service property, and create service
resources linked back to the subscription (not the application).
origin_resource = "subscription"
[[create_resource]]
property_origin = "application" # Read the property from the related application
create_from = { property = "service" }
relation_type = "USES"
relation_origin = "origin_resource" # Start the new relation from the subscription
Pattern 2: Creating from a Data List
When used with list, create_from iterates over a variable defined in the file header. This is ideal for
bootstrapping a graph from configuration data rather than from existing graph resources. No origin_resource is
needed or available.
# data/models/providers.toml
# No origin_resource is defined.
provider_list = ["aws", "azure", "gcp"]
[[create_resource]]
create_from = { list = "provider_list", as = "provider" }
name = "cloud-{{ value }}"
[create_resource.properties]
short_name = "{{ value | upper }}"
category = "IaaS"
Result: Three provider resources are created: cloud-aws, cloud-azure, and cloud-gcp.
Comparison of Creation Patterns
| Feature | Direct Derivation | From Property (create_from) |
From List (create_from) |
|---|---|---|---|
| Trigger | Existence of a graph resource | Values inside a property | A data list in the header |
origin_resource available? |
Yes | Yes (plus {{ value }}) |
No — only {{ value }} |
| Cardinality | 1:1 | 1:N | N resources from N list items |
| Default resource type | resource_type (required) |
Property name | List name |
| Default name | name template (required) |
Property value | List item value |
| Primary use case | Structural relationships | Dependencies declared as data | Bootstrapping from config |
For the full [[create_resource]] directive reference including copy_from, see
[[create_resource]] Reference.