Monitors as code with Terraform
Define your monitors, alerts and status pages next to the infrastructure they watch, with the Navy Terraform provider.

Most teams create monitors by hand, one at a time, in a dashboard. That works for ten monitors. At a hundred, monitors drift out of sync with the services they watch. The Navy Terraform provider lets you define monitoring next to the infrastructure it covers.
1. Why monitors belong in code
When a new service launches, its monitors should launch with it. When a service is removed, its monitors should go too. Keeping both in the same repository means they are reviewed, versioned and deployed together.
2. Install the provider
Add the Navy provider to your Terraform configuration and set an API token from your workspace settings. The provider talks to the same REST API as the dashboard, so anything you can do by hand you can do in code.
3. Define a monitor
A monitor is a resource with a type, a target and a check interval. An HTTP monitor needs a URL, the expected status code and, if you want, a keyword to look for in the response. Regions default to all 18.
4. Attach alerts and escalation
Reference an alert policy from the monitor so every new service gets the right routing from day one. Escalation policies and on-call schedules are resources too, so the people who get paged are in version control as well.
5. Add monitors to a status page
Status page components can reference monitors directly. When a monitor opens an incident, the matching component on your status page updates. Adding a service to the page becomes a one-line change in a pull request.
6. Use modules for repeated patterns
Most services need the same set of checks: an HTTP monitor, an SSL certificate monitor and a heartbeat for background jobs. Wrap them in a module and reuse it for every service. New services get full coverage without anyone remembering a checklist.
7. Plan before you apply
Terraform shows exactly which monitors will be created, changed or removed before anything happens. Review the plan in CI like any other change. If you prefer YAML, the Navy CLI applies the same config without Terraform.
| Tool | Best for | Config format |
|---|---|---|
| Terraform provider | Teams already on Terraform | HCL |
| Navy CLI | Small teams and CI scripts | YAML |
| REST API | Custom tooling | JSON |
Monitors as code means monitoring is never an afterthought. Define it once, review it like code and let every deploy keep it up to date.


