What is a Deployment?
A deployment is a logical unit of software that you want to orchestrate:- API Service - Your backend API
- Frontend Application - Web or mobile frontend
- Background Worker - Async job processor
- Database Migration - Schema changes
- Configuration Update - Infrastructure configuration
Deployment Properties
name
Human-readable display name for the deployment. Examples: “API Service”, “Frontend Application”, “Payment Processor”slug
URL-friendly identifier, unique within the workspace. In the Terraform provider, the slug is auto-generated from thename field.
Examples: api-service, frontend-app, payment-processor
resourceSelector
A CEL expression that limits which resources this deployment can target. If specified, only resources matching this expression will have release targets created. Examples:jobAgents
An array of job agent configurations that execute deployment jobs. Each entry specifies which agent to use and how to configure it, with optional routing via selectors.
When multiple job agents are configured, the
selector field determines which
agent handles which resources. This enables patterns like using ArgoCD for
some clusters and GitHub Actions for others within the same deployment.
metadata
Optional key-value pairs for classification and policy matching:deployment.metadata['tier'] == 'critical').
Creating a Deployment
Via Terraform
- GitHub Actions Agent
- ArgoCD Agent
Deployments must be linked to a system using
ctrlplane_deployment_system_link.
This is a separate resource that associates a deployment with a system.Via REST API
202 Accepted with the deployment id. Reads are available
immediately via GET /v1/workspaces/{workspaceId}/deployments/{deploymentId}.
Via CLI (YAML)
Multiple Deployments
- Terraform
- CLI
Job Agent Configuration
Eachjob_agent block (Terraform) or entry in the jobAgents array (API)
configures how a specific agent executes deployments. The Terraform provider
supports typed provider blocks for each agent type.
GitHub Actions
ArgoCD
Terraform Cloud
Agent Routing with Selectors
When a deployment uses multiple job agents, useselector to route to specific
resources:
Deployment Versions
Versions represent specific builds or releases of your deployment. They are typically created by your CI system after building.Version Properties
Creating Versions (from CI)
After your CI builds an artifact, create a version in Ctrlplane:Version Status
Versions have a status field:building- Version is being built (won’t be deployed yet)ready- Version is ready for deployment (default for policies)failed- Build failed (won’t be deployed)
- CI starts building → Create version with status
building - Build succeeds → Update status to
ready - Ctrlplane creates releases/jobs for
readyversions
- Build completes → Create version with status
readyimmediately
Version Config vs Job Agent Config
config: General version configuration, visible in UIDeployment Variables
Variables allow environment-specific or resource-specific configuration that gets resolved at job creation time and passed to the job agent.Via Terraform
The Terraform provider has dedicated resources for deployment variables and their values:Reference Values
Variable values can reference data from the workspace or resource metadata instead of using literal values:Via REST API
Create a variable:Using Variables in Jobs
Variables are resolved during job creation and passed to the job agent:Release Targets
When you create a deployment, Ctrlplane automatically creates release targets by crossing the deployment with environments and resources. Formula:Deployment × Environment × Resource = Release Targets
Example:
Given:
- Deployment: “API Service”
- Environments: Development, Staging, Production
- Resources in Production: 3 clusters
- API Service → Development → dev-cluster
- API Service → Staging → staging-cluster
- API Service → Production → prod-cluster-1
- API Service → Production → prod-cluster-2
- API Service → Production → prod-cluster-3
Filtering Release Targets
Use the deployment’sresourceSelector to limit which targets are created:
Deployment Lifecycle
1. Create Deployment
Define the deployment in Ctrlplane with job agent configuration.2. CI Builds and Creates Version
Your CI pipeline builds the artifact and creates a deployment version.3. Ctrlplane Evaluates Policies
Ctrlplane checks policies (approvals, environment progression, etc.).4. Jobs Created
For each release target that should receive the version, a job is created.5. Job Agent Executes
The configured job agent picks up the job and executes the deployment.6. Status Updated
The job reports status back to Ctrlplane.REST API Reference
Deployment CRUD
Create:Versions
Create version:Variables
Upsert variable:Terraform Provider Reference
Viewing Deployment Status
Via Web UI
- Navigate to the deployment
- See tabs:
- Versions: All versions created
- Releases: Active releases across targets
- Jobs: Execution history
- Variables: Configured variables
Via API
Get deployment details:Common Patterns
Microservices
- Terraform
- CLI
Database + Application
Multi-Platform
Best Practices
Naming
Good Names:- ✅ “API Service”
- ✅ “Frontend Application”
- ✅ “Payment Processor”
- ✅
api-service - ✅
frontend-app - ✅
payment-processor
- ❌ “Service” (too generic)
- ❌ “api_service” (use hyphens)
- ❌ “API-SERVICE” (use lowercase)
Job Agent Configuration
Do:- ✅ Use version’s
jobAgentConfigfor version-specific values (like image tags) - ✅ Use deployment’s job agent config for stable configuration
- ✅ Keep sensitive data in secrets (not in config)
- ✅ Use agent
selectorwhen routing to different resource types
Version Tags
Good Tags:- ✅
v1.2.3(semantic version) - ✅
2024-01-15-prod(date-based) - ✅
abc123def(git commit)
- ❌
latest(not specific) - ❌
prod(not a version) - ❌
test(too vague)
Resource Selectors
Use CEL resource selectors to:- Limit Kubernetes deployments to Kubernetes resources
- Filter by resource status (e.g.,
resource.metadata['status'] == 'running') - Separate platform-specific deployments
- Control which resources can receive a deployment
Troubleshooting
No release targets created
- Check
resourceSelectorCEL expression matches some resources - Verify environments have matching resources
- Ensure deployment is linked to a system (via
ctrlplane_deployment_system_linkin Terraform)
Jobs not being created for new versions
- Check version status is
ready - Review policies for denials/pending approvals
- Verify job agent is configured
- Check release target exists
Job agent config not working
- Verify job agent block matches the agent type (e.g.,
github {}for GitHub Actions agents) - Check version’s
jobAgentConfigoverrides correctly - Review job agent logs for configuration errors
Next Steps
- Releases and Jobs - Understand version lifecycle
- Release Targets - How the deployment matrix works
- CI/CD Integration - Integrate with your CI system
- Job Agents - Configure deployment executors
- Policies - Control when and how deployments proceed