Run triggers and notifications are powerful collaboration features in HCP Terraform (formerly Terraform Cloud) that help automate and coordinate infrastructure workflows across multiple workspaces.
**Run Triggers**
Run triggers establish dependencies between workspaces, allowing one workspace to …Run triggers and notifications are powerful collaboration features in HCP Terraform (formerly Terraform Cloud) that help automate and coordinate infrastructure workflows across multiple workspaces.
**Run Triggers**
Run triggers establish dependencies between workspaces, allowing one workspace to automatically initiate a run in another workspace when its apply completes successfully. This is particularly useful when you have infrastructure that depends on resources managed in separate workspaces.
For example, if Workspace A manages your VPC and Workspace B manages EC2 instances within that VPC, you can configure Workspace B to trigger a run whenever Workspace A successfully applies changes. This ensures downstream infrastructure stays synchronized with upstream dependencies.
Key characteristics of run triggers:
- They create a source-to-target relationship between workspaces
- Only successful applies in the source workspace trigger runs in the target workspace
- A workspace can have multiple source workspaces configured
- Run triggers help maintain consistency across related infrastructure components
**Notifications**
Notifications allow HCP Terraform to send alerts about workspace events to external systems. This keeps teams informed about infrastructure changes and enables integration with existing communication and monitoring tools.
Supported notification destinations include:
- Slack channels
- Microsoft Teams
- Email addresses
- Generic webhooks for custom integrations
You can configure notifications to trigger on various events:
- Run started, needs attention, completed, or errored
- Assessment results
- Drift detection findings
Notifications help teams:
- Stay informed about infrastructure changes in real-time
- Respond quickly to failed runs or issues requiring approval
- Maintain audit trails of infrastructure modifications
- Integrate Terraform workflows with incident management systems
Both features enhance team collaboration and operational efficiency by automating coordination between workspaces and keeping stakeholders informed about infrastructure state changes throughout the deployment lifecycle.
Run Triggers and Notifications in HCP Terraform
Why Run Triggers and Notifications Matter
Run triggers and notifications are essential features in HCP Terraform (formerly Terraform Cloud) that enable automation and visibility across your infrastructure workflows. They help teams maintain awareness of infrastructure changes and create dependencies between workspaces, which is critical for managing complex, interconnected infrastructure.
What Are Run Triggers?
Run triggers establish a relationship between workspaces where a successful run in one workspace (the source) automatically initiates a run in another workspace (the target). This creates a dependency chain that ensures downstream infrastructure updates when upstream changes occur.
Key characteristics of run triggers: - A workspace can have up to 20 source workspaces configured - Runs are only triggered after a successful apply in the source workspace - The target workspace must have access to read the source workspace - Run triggers work across workspaces within the same organization
What Are Notifications?
Notifications allow HCP Terraform to send alerts about run events to external systems. These keep teams informed about the status of infrastructure changes.
Supported notification destinations include: - Slack - Microsoft Teams - Email - Generic webhooks
Notification triggers can be configured for various run states: - Run created - Run needs attention (requires approval) - Run errored - Run completed - Run planning - Run applying
How Run Triggers Work
1. Configure a source workspace in the target workspace settings 2. When the source workspace completes a successful apply, HCP Terraform detects this event 3. A new run is automatically queued in the target workspace 4. The target workspace follows its normal run workflow (plan, approval if required, apply)
How Notifications Work
1. Configure a notification in the workspace settings 2. Select the destination type (Slack, Teams, webhook, or email) 3. Choose which run events should trigger notifications 4. When the selected events occur, HCP Terraform sends the notification to the configured destination
Use Cases
- Cascading infrastructure updates: When a VPC workspace updates, automatically trigger application workspaces that depend on it - Team awareness: Notify a Slack channel when production infrastructure runs need approval - CI/CD integration: Use webhooks to trigger downstream pipelines after infrastructure provisioning
Exam Tips: Answering Questions on Run Triggers and Notifications
1. Remember the direction: Run triggers flow from source to target. The source workspace triggers runs in the target workspace.
2. Know the limit: A workspace can have a maximum of 20 source workspaces for run triggers.
3. Successful applies only: Run triggers only fire after a successful apply, not after failed runs or plan-only operations.
4. Same organization requirement: Run triggers only work between workspaces in the same organization.
5. Notification types: Be familiar with all supported notification destinations - Slack, Microsoft Teams, email, and generic webhooks.
6. Webhooks for custom integrations: When questions ask about integrating with custom or third-party systems, generic webhooks are the answer.
7. Run trigger vs VCS triggers: Understand that run triggers are workspace-to-workspace, while VCS triggers are repository-to-workspace.
8. Permissions matter: The target workspace needs appropriate permissions to the source workspace for run triggers to function.
9. Queue behavior: Triggered runs are queued like any other run and follow the workspace's normal execution order.