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 |