A lab of reusable Terraform modules fed by JSON for alerting profiles, notifications, and anomaly detection.
15 Jul 2026 · Not a shipped product
This is a lab for a pattern I want to be boring. It is not a monitoring platform I operate for a company.
Clicking alerting rules into a UI does not leave a reviewable history. Writing every rule as a raw Terraform resource does leave a history, and it also leaves a diff only one person can read. I wanted the review to stay in JSON, and the provider details to stay in a module.
The review surface is the JSON. The module maps it onto Dynatrace.
01
JSON files
Alerting profiles, who gets told, and anomaly detection. A person can read these without learning every resource argument.
02
Terraform module
jsondecode, for_each, and a small module. The plan is the diff you review.
03
Dynatrace
Alerting, notifications, anomaly detection. A flag decides whether a rule is allowed to page a human.
JSON files describe alerting profiles, notification targets, and anomaly detection. A Terraform module reads them with jsondecode and for_each, and maps the fields onto the Dynatrace provider. The provider version is pinned. Plan is the thing I read before apply.
The module is small on purpose. If a field is not in the JSON shape, it does not get a secret second path.
A typo in a JSON key. The module ignored keys it did not know, so the plan was clean and the notification was missing. Silence is a bad error. Unknown keys fail the plan now.
I edited a profile in the UI to "just look." The next plan wanted to revert it. That is correct behaviour, and it is also how you ship a surprise if you apply on autopilot. The JSON stays the source of truth.
Anomaly detection on a noisy demo signal would have paged a person if the target had been real. I split "create the rule" from "notify a human," and the notify flag defaults to off.
Boring modules survive contact with a reviewer. A plan that hides a dropped field is not a plan. Do not point a lab rule at a real on-call rotation.
I wrote the pattern up as a draft note, with the same failures and less of the lab tour.