How It Works
- Ctrlplane renders a workspace configuration from your template
- The workspace is created or updated via Terraform Cloud API
- Variables are synced to match your template
- A webhook notification configuration (
ctrlplane-webhook) is created on the workspace (idempotent) - A run is triggered with auto-apply
- Terraform Cloud sends webhook notifications as the run progresses
- The ctrlplane API receives webhooks and updates job status in the database
Prerequisites
- Terraform Cloud or Terraform Enterprise account
- API token with workspace, run, and notification configuration permissions
- VCS connection (optional, for Git-based workflows)
- A reachable webhook endpoint (the ctrlplane API must be accessible from TFC)
Configuration
Job Agent Setup
Create a job agent with typetfe:
Deployment Configuration
Environment Variables
Both the API and workspace-engine must share the same
TFE_WEBHOOK_SECRET.
Webhook Status Mapping
When TFC sends a notification, the webhook handler maps the trigger to a ctrlplane job status:Workspace Template
The template defines the Terraform Cloud workspace:VCS Repository Settings
Variable Configuration
Template Context
The template has access to the full dispatch context:triggerRunOnChange: false
When triggerRunOnChange is set to false, the dispatcher will:
- Upsert the workspace
- Sync variables
- Ensure the notification config exists
- Skip creating a run
Note: Correlating VCS-triggered runs back to ctrlplane jobs (by workspace name/ID instead of run ID) is a planned follow-up.
Example: Multi-Environment Infrastructure
Example: Agent-Based Execution
For private infrastructure, use agent execution mode:Terraform Provider Configuration
When using the ctrlplane Terraform provider:Troubleshooting
Workspace creation fails
- Verify organization name is correct
- Check API token has workspace:write permission
- Ensure workspace name is valid (alphanumeric, hyphens, underscores)
VCS connection errors
- Verify OAuth token ID is correct
- Check repository exists and is accessible
- Ensure branch or tag exists
Run fails to start
- Check workspace has valid configuration
- Verify VCS connection is working
- Review workspace settings in Terraform Cloud UI
Variables not updating
- Verify variable keys match expected format
- Check for duplicate variable definitions
- Sensitive variables won’t show values in UI
Webhook returns 401
- Check
TFE_WEBHOOK_SECRETis set on the API - Verify the same secret was used when creating the notification config on TFC
- Ensure the
x-tfe-notification-signatureheader is present
No webhook notifications received
- Verify the
webhookUrlis reachable from Terraform Cloud - Check the notification config exists on the TFC workspace (Settings > Notifications)
- Review TFC’s notification delivery log for errors
- For local development, use smee.io or localtunnel to expose your API
Job stays in inProgress
- Verify webhooks are reaching the API (check API logs for
POST /api/tfe/webhook) - Check the TFC run status directly in the TFC UI