From Vibecoding to IaC
Start fast with the console or API, then export to Terraform when you're ready for production. This workflow lets you prototype quickly while maintaining the benefits of infrastructure as code.
The Workflow
- Prototype: Use the console or API to create checks quickly
- Validate: Confirm the checks work as expected
- Export: Generate Terraform configuration from your checks
- Commit: Check the Terraform into version control
- Manage: Future changes go through Terraform
Exporting Your Checks
# Export all checks in your organization
curl -X GET https://api.quismon.com/v1/exports/terraform \
-H "Authorization: Bearer $API_KEY" \
-o quismon-checks.tf
This generates a Terraform file with all your checks, alert rules, and notification channels. GET /v1/exports/json returns the same data as JSON if you want to process it yourself.
Step by Step
1. Get an API key
Create one in the console under API Keys, or use POST /v1/auth/quick-signup to get one instantly.
2. Export your configuration
curl -X GET https://api.quismon.com/v1/exports/terraform \
-H "Authorization: Bearer $API_KEY" \
-o main.tf
3. Set up variables
variable "quismon_api_key" {
type = string
sensitive = true
}
provider "quismon" {
api_key = var.quismon_api_key
}
4. Initialize and import
The export includes import blocks, so Terraform adopts your existing resources instead of recreating them:
terraform init
terraform plan # review
terraform apply # imports existing resources
5. Verify
# Should report "No changes" - infrastructure matches configuration
terraform plan
What Gets Exported
| Resource Type | What's Captured |
|---|---|
| Checks | All check types, including multi-step workflows |
| Notification Channels | Email, Slack, ntfy, and webhook configurations |
| Alert Rules | Conditions, thresholds, and channel associations |
| Outputs | Resource IDs for reference in other modules |
Secrets are never exported
Sensitive values are automatically excluded from exports. Fields such as smtp_password, imap_password, password, api_key, token, secret, private_key, and access_token are stripped wherever they appear in check or channel configs.
Set them yourself before applying, ideally from Terraform variables:
# terraform.tfvars (do not commit)
smtp_password = "your-secret-password"
# main.tf
resource "quismon_check" "mail_server" {
name = "Mail Server Health"
type = "smtp-imap"
config = {
smtp_host = "smtp.example.com"
smtp_port = "587"
smtp_username = "alerts@example.com"
smtp_password = var.smtp_password
}
}
Generated Configuration Structure
# Generated by the Quismon Terraform Export
terraform {
required_providers {
quismon = {
source = "quismon/quismon"
version = "~> 1.0"
}
}
}
provider "quismon" {
api_key = var.quismon_api_key
}
resource "quismon_check" "api_health" {
name = "API Health"
type = "https"
enabled = true
interval_seconds = 60
regions = ["na-east-ewr", "eu-central-fra"]
config = {
url = "https://api.example.com/health"
method = "GET"
expected_status_code = "200"
}
}
resource "quismon_notification_channel" "slack_alerts" {
name = "Slack Alerts"
type = "slack"
enabled = true
config = {
webhook_url = "https://hooks.slack.com/services/..."
}
}
resource "quismon_alert_rule" "api_down" {
name = "API Down"
check_id = quismon_check.api_health.id
enabled = true
condition = {
failure_threshold = 3
}
notification_channel_ids = [
quismon_notification_channel.slack_alerts.id
]
}
output "check_ids" {
value = {
api = quismon_check.api_health.id
}
}
The export writes every config value as a string, matching what the API accepts; the provider's config map and config_json are interchangeable, and config_json is the right choice for nested values.
Why This Works Well
- Zero-downtime migration: resources are imported, not recreated — monitoring continues uninterrupted
- Complete capture: check configs, channels, alert rules, and their relationships move together
- Version-control ready: the generated HCL is immediately commit-ready
- Team review: changes go through pull requests like any other code
- Disaster recovery: rebuild the whole monitoring setup with
terraform apply
Workflow Integration
CI/CD
# .github/workflows/monitoring.yml
name: Update Monitoring
on:
push:
paths: ['monitoring/**']
jobs:
apply:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: hashicorp/setup-terraform@v3
- run: terraform init
working-directory: monitoring
- run: terraform apply -auto-approve
working-directory: monitoring
env:
TF_VAR_quismon_api_key: ${{ secrets.QUISMON_API_KEY }}
Pre-commit hooks
# .pre-commit-config.yaml
repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.83.5
hooks:
- id: terraform_fmt
- id: terraform_validate
Tips and Best Practices
- Review before committing: the export may include test checks you want to remove
- Separate environments: one directory per environment, shared patterns in modules
- Keep secrets out of git:
*.tfvarsignored except*.tfvars.example - Import blocks: the export generates Terraform 1.5+
importblocks, soapplyadopts existing resources - Re-export after manual changes: if you change something in the console, re-export and diff against your committed HCL
- Don't re-import: once a resource is in Terraform, manage it through Terraform only
# Re-export and diff after console changes
curl -H "Authorization: Bearer $API_KEY" \
https://api.quismon.com/v1/exports/terraform > current.tf
diff main.tf current.tf
Handling Expiring Checks
The Terraform provider handles expiring checks specially:
- Expiring checks are included in exports but won't cause Terraform drift
expires_after_secondsis read-only in Terraform- Use expiring checks for deployment verification, not permanent monitoring
Troubleshooting
"Provider returned invalid result object"
This indicates a provider bug; upgrade to the latest provider version (~> 1.0).
Duplicate resource names
The export disambiguates by prefixing the resource type (for example ntfy_alerts, slack_alerts) and appending a short suffix when names still collide.
Alert-rule import format
Alert rules use the import ID format check_id:rule_id. The export generates this automatically.
API Reference
| Endpoint | Description |
|---|---|
GET /v1/exports/terraform | Export as Terraform HCL |
GET /v1/exports/json | Export as JSON |
Both endpoints require authentication via a Bearer API key.
See Also
- Terraform Provider - full provider documentation and examples
- Terraform Registry - versions and changelog
- Expiring Checks - temporary monitoring
- Check Types & Execution - what each check type validates