# Daily Terraform health digest, posted straight to Slack

> Every weekday morning, your platform team gets one short Slack message ranking Terraform runs that failed, need approval, or are still applying.

- Workflow type: agent
- Services: HCP Terraform (Terraform Cloud), Slack Bot
- Categories: Engineering, Operations
- Published: 2026-07-17

## What it does

- Runs every weekday morning and reviews the last 24 hours of activity across all of your Terraform workspaces.
- Groups the runs that matter into three buckets: failures, runs waiting for approval, and runs still applying.
- Explains in plain language what each run is and why it deserves attention, with a direct link to open it.
- Posts one short, scannable message to your infrastructure channel, with failures and stuck approvals at the top.

## What you'll need

- An HCP Terraform (Terraform Cloud) account with an API token
- A Slack workspace with the General Input bot added to your infrastructure channel
- The name of the Terraform organization you want to monitor

## Prompt

Every weekday at 8:00am, put together a prioritized health digest of my organization's HCP Terraform (Terraform Cloud) infrastructure and post it to my platform team's infrastructure channel in Slack. The goal is one short, scannable message that surfaces only the runs that need a human to look at them.

Start by calling List Workspaces to pull every workspace in my Terraform organization. For each workspace, use List Workspace Runs with status filtering to gather the runs from the last 24 hours. Focus on the runs that need attention: failed runs (status errored), runs waiting for approval (status planned or awaiting confirmation), and runs that are still applying (status applying or otherwise not yet finished). You can lean on filter[status_group] (non_final, final, discardable) to narrow the list, and treat applied, planned_and_finished, discarded, and canceled as finished states that usually do not need to appear.

For anything that looks noteworthy, call Show Run to get the run's current status, the reason it stopped or is waiting, and its links. Use that detail to write a plain-language, one-line explanation of what each run is and why it matters, so a teammate who did not trigger it can understand the situation at a glance.

Group the results into three sections: Failed runs, Waiting for approval, and Still applying. Sort the digest so failures and stuck approvals sit at the top, since those are the most urgent. Skip any workspace that has nothing noteworthy so the message stays short. Include a direct link to each run so my team can jump straight to it in HCP Terraform (for example, https://app.terraform.io/app/<org>/workspaces/<workspace>/runs/<run-id>).

Post the finished digest as a single message to my infrastructure channel using the Slack Bot Send a Message action. Keep it clean and scannable: a short header, the three grouped sections, and one line per run with its workspace name, a plain-language summary, and the link. If nothing is noteworthy across every workspace, post a brief all-clear line instead so the team knows the check ran and everything is healthy. This workflow should only read from Terraform; never approve, cancel, or start a run.

## How to customize

- Change the timing (for example, twice a day or only on Mondays) or the Slack channel it posts to.
- Adjust the lookback window from 24 hours to whatever matches how often your runs happen.
- Decide which run states count as noteworthy, for example also flagging runs that were canceled or discarded.

## FAQ

### Does this send a separate alert for every run?

No. It rolls everything into one message per morning and skips workspaces with nothing worth reporting, so the digest stays short and easy to scan.

### Will it change anything in my Terraform setup?

No. It only reads run and workspace information. It never approves, cancels, or starts a run, so it is safe to point at production infrastructure.

### What counts as needing attention?

Failed runs, runs waiting for approval, and runs that are still applying. You can broaden or narrow this list when you set the workflow up.

### Can it post to a private Slack channel?

Yes, as long as you add the bot to that channel first so it has permission to send messages there.

### What happens on a quiet day with nothing to report?

It posts a brief all-clear line so your team knows the check ran and everything is healthy, rather than staying silent.

Use this prompt in General Input: https://www.generalinput.com/prompts/daily-terraform-health-digest-posted-straight-to-slack