pipe subcommand reads JSON resource data from stdin and upserts it into
Ctrlplane via a resource provider. This is the most flexible sync method — use
it to integrate any data source, script output, or API response without writing
a dedicated provider.
Usage
Flags
Global flags (
--api-key, --workspace, --url)
are also supported.
Input Format
ctrlc sync pipe accepts JSON in two forms:
Array of Resources
Single Resource Object
A single object (without the array wrapper) is also accepted and is automatically normalized to a one-element array:Required Fields
Every resource must include these fields:Optional Fields
For details on the distinction between metadata and config, see
Resource Schema.
Examples
Pipe from a Discovery Script
Run a custom script that outputs JSON and pipe it directly:Inline JSON
Quick one-liner to register resources:Single Resource
No array wrapper needed for a single resource:Transform API Responses with jq
Fetch data from an internal API and reshape it into the expected schema:Sync from a CMDB with Metadata
Include metadata so resources can be targeted by environment selectors:Database Inventory from PostgreSQL
Query a database and pipe the results:Running on a Schedule with cron
Sync resources every 5 minutes:Running in CI/CD
Usesync pipe in a GitHub Actions workflow to register build artifacts as
resources:
Behavior
- Provider auto-creation — If the named provider doesn’t exist, it is created automatically.
- Upsert semantics — Resources are matched by
identifier. Existing resources are updated; new ones are created. - Stdin required — The command exits with an error if no piped input is detected or if stdin is empty.
- Validation — Each resource is validated for the required fields (
name,identifier,version,kind) before the API call. Missing fields produce a descriptive error message.
Error Handling
Best Practices
Use Stable Identifiers
Choose identifiers that won’t change across syncs:Include Rich Metadata
Metadata powers Ctrlplane’s environment selectors. Include attributes that are useful for targeting:Follow the Kind Naming Convention
Use aCategory/Type format for consistency:
Validate Before Syncing
Pipe throughjq to catch malformed JSON early:
Next Steps
Resource Providers
Overview of all resource providers
Custom Provider
Build a custom provider via API or SDK
Selectors
Target resources with environment selectors
Environments
Create dynamic environments