Teams Adaptive Card Terraform Drift Alert Prompt
Build a Microsoft Teams Adaptive Card that reports Terraform/OpenTofu configuration drift — resources changed outside code, add/change/destroy counts, blast-radius flags, and a reconcile action.
- Target user
- Platform engineers running IaC drift detection
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT, Cursor
The prompt
You are a platform engineer who has built Terraform/OpenTofu drift detection that reports into Microsoft Teams as Adaptive Cards, backed by a scheduled `plan` in CI and a controlled apply path. I will provide: - IaC tool (Terraform or OpenTofu) and backend (S3/GCS/Terraform Cloud/Spacelift) - Which stacks/workspaces are monitored and their criticality - Drift detection cadence (scheduled `plan -detailed-exitcode`) - Target Teams channels and stack ownership - Whether reconcile/apply from Teams is allowed and its approval policy Your job: 1. **Detection** — a scheduled CI job running `terraform plan -detailed-exitcode -json` (exit 2 = drift). Explain parsing the JSON plan (`resource_changes[]`, `change.actions` = create/update/delete/replace) into counts and a per-resource summary, with sensitive values redacted. 2. **Blast-radius scoring** — classify drift severity: destroys/replaces of stateful resources (DBs, disks, load balancers) = high; tag-only updates = low. Flag out-of-band changes (drift where code didn't change) vs pending code changes. 3. **Card design** — Adaptive Card 1.5: - Header: stack/workspace, run time, and add/change/destroy counts as colored badges (destroy = attention) - A `Container` listing the top changed resources with the action and address (`aws_db_instance.primary` -> update) - A blast-radius badge for high-risk changes - `Action.OpenUrl` to the full plan in CI and the state backend - `Action.Execute` "Approve reconcile", "Open PR", "Ignore this drift", "Acknowledge" with `verb`/`data` 4. **Reconcile handler** — the invoke flow: on "Approve reconcile", require a second approver (two-person rule for high blast radius), map the Teams user to a CI identity, trigger the pipeline's `apply` for that workspace, and refresh the card with the run link and result. Never apply directly from the card process. 5. **Noise control** — suppress known/benign drift via an ignore-list (e.g. autoscaling desired_count), dedup by stack + plan hash, and update one card per stack per cycle instead of reposting. 6. **Reliability** — handle plan failures (lock contention, auth) distinctly from "no drift"; retry Teams post; never post "no drift" when the plan actually errored. 7. **Audit** — log who approved a reconcile and the resulting apply, reflected in the card footer. Output as: (a) the scheduled plan + JSON parsing outline, (b) the blast-radius scoring rules, (c) Adaptive Card JSON, (d) the two-person reconcile handler triggering CI apply, (e) noise-suppression/dedup rules, (f) plan-failure handling and audit. Bias toward: two-person approval for destructive drift, redaction of sensitive plan values, and never conflating a failed plan with a clean state.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
Teams Terraform Plan Review Card Prompt
Post a summarized Terraform plan into Microsoft Teams as a reviewable Adaptive Card so engineers can assess adds/changes/destroys and approve or block the apply from chat.
-
Teams Adaptive Card Backup Job Status Digest Prompt
Design a Microsoft Teams Adaptive Card that summarizes nightly backup job outcomes — success/failure counts, failed jobs with reason, RPO breaches, and restore-test status — for the platform team.
-
Teams Adaptive Card CVE Advisory Digest Prompt
Design a daily CVE / security advisory digest posted to Microsoft Teams as an Adaptive Card — severity grouping, CVSS badges, affected-asset counts, and drill-down actions for the security team.
-
Teams Adaptive Card Kubernetes CrashLoopBackOff Alert Prompt
Design a Microsoft Teams Adaptive Card that surfaces Kubernetes CrashLoopBackOff pod alerts with restart counts, last-termination reason, container logs snippet, and one-click remediation actions.
More Microsoft Teams prompts & error guides
Browse every Microsoft Teams prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.