On this page
Resources and models
Resources
A resource represents something managed on the platform, such as a device or a workflow. Its block describes the configuration you want. The CLI compares that configuration with the platform when planning changes.
A resource's local name identifies its block in your configuration. Its platform identity is a separate field, often assigned when the resource is created.
The resource reference distinguishes required, optional and read-only fields. Read-only values can be referenced by other blocks, but are not configuration you supply.
Native models
Models are structured values. Use them to describe a document or one of its parts, give that value a name and reference it from another model.
Models do not create separate platform objects. They have no independent identity, state or create-and-delete lifecycle. The resource that uses the document owns its lifecycle.
The model reference lists the fields each model accepts, including nested structures and alternative shapes. A reference such as workflow_node.your_name identifies a named model value; a member reference selects one of its fields.
Composition
Build documents from smaller model values. References keep the parts connected without copying their contents into every place they are used. Use the field definitions to choose the expected shape, including fields that accept a list or exactly one of several alternatives.
Models can also reference resource values. This lets the CLI track dependencies between the configuration you author and the platform resources it uses.
Compose a workflow
This example puts a log node inside a workflow document and assigns the document directly to a workflow version. The version references the workflow's platform ID.
workflow_node "log_message" {
id = "log_message"
type = "log"
config = {
message = "Workflow started"
level = "info"
}
}
workflow_document "example" {
nodes = [workflow_node.log_message]
}
workflow "example" {
name = "Log a message"
}
workflow_version "example" {
workflowId = workflow.example.id
sourceXML = workflow_document.example
}The node and document are local model values. The workflow and its version are managed resources. You can change the message in the node without copying the document into the resource block.