Why Relationships?
Understanding infrastructure dependencies helps you:- Visualize architecture — See how resources connect across your stack
- Impact analysis — Understand what’s affected when a resource changes
- Deployment ordering — Deploy dependencies before dependents
- Troubleshooting — Trace issues through connected resources
Relationship Rules
Relationship rules automatically create connections between entities based on matching criteria. When resources are synced, Ctrlplane evaluates rules and creates relationships dynamically.Structure
Components
| Field | Description |
|---|---|
fromType | Source entity type (resource, deployment, environment) |
toType | Target entity type (resource, deployment, environment) |
relationshipType | Type of connection (see below) |
fromSelector | Selector matching source entities |
toSelector | Selector matching target entities |
propertyMatchers | Property conditions for matching |
Relationship Types
| Type | Description | Example |
|---|---|---|
contains | Parent contains child | VPC contains clusters |
runs-on | Service runs on infrastructure | App runs on cluster |
depends-on | Requires another resource | API depends on database |
deployed-by | Managed by a deployment | Resource deployed by pipeline |
deploys-to | Deployment targets environment | Service deploys to production |
Examples
VPC to Kubernetes Clusters
Connect VPCs to the Kubernetes clusters running within them:- Finds all resources with
kind: vpc - Finds all resources with
kind: kubernetes-cluster - Creates a
containsrelationship when both have the same region AND account
Database Dependencies
Model which services depend on which databases:Deployment to Environment
Link deployments to the environments they target:Cross-Account Resources
Connect resources across AWS accounts:Property Matchers
Property matchers define conditions for when relationships should be created between matching entities.Operators
| Operator | Description | Example |
|---|---|---|
equals | Exact match | Region equals region |
contains | Array contains value | Tags contain team |
startsWith | String prefix match | Name starts with “prod-” |
regex | Regular expression | Name matches pattern |
Nested Properties
Access nested properties using array paths:Multiple Matchers
All property matchers must match for a relationship to be created:Selectors
Selectors filter which entities are considered for relationships.By Kind
By Metadata
By Name
Managing Relationship Rules
Create a Rule
Update a Rule
Delete a Rule
Use Cases
Infrastructure Topology
Model your complete infrastructure hierarchy:Service Dependencies
Track service-to-service and service-to-infrastructure dependencies:Multi-Cloud Relationships
Connect resources across cloud providers:Best Practices
Use Meaningful Relationship Types
Choose relationship types that reflect the actual connection:Keep Property Matchers Simple
Start with minimal matchers and add more only if needed:Document Your Rules
Add descriptions to explain the purpose:Next Steps
CEL Reference
Full expression language reference
Selectors
Learn selector syntax
Dynamic Environments
Create environments from relationships
Resource Providers
Sync infrastructure automatically