HashiCorp : Terraform Cloud

Advanced Topics

Lab Solution Notifications

Terraform Cloud notifications let you track workspace events—such as runs completing, errors, or drift detection—in real time. By integrating email, Slack, Microsoft Teams, or generic webhooks, you can keep your team informed and responsive throughout the Terraform workflow.

Step 1: Enable Workspace Notifications

  1. Log in to Terraform Cloud and select the DevOps AWS MyApp Dev workspace.
  2. Navigate to Settings > Notifications.

The image shows a KodeKloud lab interface with instructions for creating Terraform Cloud notifications on the left and a Visual Studio Code editor with a welcome message on the right.

If this workspace has no notifications configured, the list will be empty:

The image shows a Terraform Cloud interface for a workspace named "devops-aws-myapp-dev," with a focus on the Notifications section, where users can create notifications for workspace events.

Click Create notification to begin.

Step 2: Create an Email Notification

Terraform Cloud supports four notification destinations:

  • Email
  • Slack
  • Microsoft Teams
  • Generic Webhook

The image shows a user interface for creating a notification, offering options to send messages via Webhook, Email, Slack, or Microsoft Teams. The sidebar includes workspace settings like Notifications, Run Tasks, and Team Access.

2.1 Configure Email Settings

  1. Select Email as the destination.
  2. Enter Terraform run completed as the notification name.
  3. From Recipient, choose your Terraform Cloud login email.
  4. Under Events, uncheck All events, then select only Completed.

The image shows a settings menu for configuring notifications in a software application, with options for different run events like "Created," "Planning," "Needs Attention," "Applying," "Completed," and "Errored."

Click Create notification. You will see the new email alert listed and enabled:

The image shows a Terraform Cloud interface with a notification setting for email alerts when a Terraform run is completed. The notification is enabled and set to send to a specified email address.

Note

Use the Send test link next to any notification to verify delivery before you rely on real run events.

Step 3: Test and Trigger a Terraform Run

  1. Click Send test on your email notification.
  2. Check your inbox for a message titled Terraform run completed—it should include workspace details and a test-run ID.

Next, trigger an actual Terraform run:

terraform apply

Once the run finishes, you’ll receive a live email with a direct link to the run details in your DevOps AWS MyApp Dev workspace:

The image shows a Terraform Cloud interface with a workspace named "devops-aws-myapp-dev," indicating a successful plan run with no changes needed. A notification about improved navigation is also visible.

Additional Notification Destinations

You can extend alerts to other platforms:

DestinationDescriptionSetup Method
EmailDirect inbox alerts for run lifecycle eventsWorkspace UI > Notifications
SlackPost events to any channel via incoming webhookProvide Slack Webhook URL
Microsoft TeamsSend updates into a Teams channel connectorConfigure Teams incoming webhook
Generic WebhookForward payloads to custom HTTP endpointsEnter target URL and authentication

Warning

Ensure your webhook endpoints are publicly reachable, and secure them with authentication or IP allowlists to prevent unauthorized requests.

You can also subscribe to health events (for drift detection) or additional run statuses like Errored and Needs Attention. Tailor notifications to align with your team’s monitoring and incident response processes.

References

Watch Video

Watch video content

Previous
Lab Solution Version Compatibility